summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2018-10-08 14:24:40 -0400
committerNicoleYarroch <nicole@livio.io>2018-10-08 14:24:40 -0400
commit5d54b5ceab3430bfcba33edf2ea41f52f7952fc7 (patch)
treedc4c3e6c70a1a456196af33c86c44e489ad889f7
parentd0ee3c1c38a3e51d4311e8e9962bb94f367fd9e7 (diff)
downloadsdl_ios-bugfix/issue_1097_manager_reconnects_after_onAppInterfaceUnregistered.tar.gz
Added protocol violation to the list of app interface unregistered reasonsbugfix/issue_1097_manager_reconnects_after_onAppInterfaceUnregistered
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r--SmartDeviceLink/SDLAppInterfaceUnregisteredReason.h11
-rw-r--r--SmartDeviceLink/SDLAppInterfaceUnregisteredReason.m1
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m2
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAppInterfaceUnregisteredReasonSpec.m2
4 files changed, 12 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.h b/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.h
index 79b3f1cf4..72222636f 100644
--- a/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.h
+++ b/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.h
@@ -43,7 +43,7 @@ extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReason
extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonDriverDistractionViolation;
/**
- * The user performed a language change on the SDL platform, causing the application to need to be reregistered for the new language.
+ * The user performed a language change on the SDL platform, causing the application to need to be reregistered for the new language.
*/
extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonLanguageChange;
@@ -58,8 +58,15 @@ extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReason
extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonFactoryDefaults;
/**
- * The app is not being authorized to be connected to SDL.
+ * The app is not authorized to be connected to SDL.
*
* @since SDL 2.0
*/
extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonAppUnauthorized;
+
+/**
+ * The app has committed a protocol violation.
+ *
+ * @since SDL 4.0
+ */
+extern SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonProtocolViolation;
diff --git a/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.m b/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.m
index cf8cae70a..d61ecc4fc 100644
--- a/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.m
+++ b/SmartDeviceLink/SDLAppInterfaceUnregisteredReason.m
@@ -14,3 +14,4 @@ SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonLanguag
SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonMasterReset = @"MASTER_RESET";
SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonFactoryDefaults = @"FACTORY_DEFAULTS";
SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonAppUnauthorized = @"APP_UNAUTHORIZED";
+SDLAppInterfaceUnregisteredReason const SDLAppInterfaceUnregisteredReasonProtocolViolation = @"PROTOCOL_VIOLATION";
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index c05ac986e..0bbbd4e34 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -719,7 +719,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
[self sdl_transitionToState:SDLLifecycleStateStopped];
} else if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateStopped]) {
return;
- } else if ([appUnregisteredNotification.reason isKindOfClass:[NSString class]] && [appUnregisteredNotification.reason isEqualToEnum:SDLAppInterfaceUnregisteredReasonAppUnauthorized]) {
+ } else if ([appUnregisteredNotification.reason isKindOfClass:[NSString class]] && ([appUnregisteredNotification.reason isEqualToEnum:SDLAppInterfaceUnregisteredReasonAppUnauthorized] || [appUnregisteredNotification.reason isEqualToEnum:SDLAppInterfaceUnregisteredReasonProtocolViolation])) {
// HAX: The string check is due to a core "feature" that could cause -1 to be sent as the enum value, which will crash here.
[self sdl_transitionToState:SDLLifecycleStateStopped];
} else {
diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAppInterfaceUnregisteredReasonSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAppInterfaceUnregisteredReasonSpec.m
index f26e01fdd..fdaf61626 100644
--- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAppInterfaceUnregisteredReasonSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLAppInterfaceUnregisteredReasonSpec.m
@@ -27,7 +27,7 @@ describe(@"Individual Enum Value Tests", ^ {
expect(SDLAppInterfaceUnregisteredReasonMasterReset).to(equal(@"MASTER_RESET"));
expect(SDLAppInterfaceUnregisteredReasonFactoryDefaults).to(equal(@"FACTORY_DEFAULTS"));
expect(SDLAppInterfaceUnregisteredReasonAppUnauthorized).to(equal(@"APP_UNAUTHORIZED"));
- //expect(SDLAppInterfaceUnregisteredReason PROTOCOL_VIOLATION).to(equal(@"PROTOCOL_VIOLATION"));
+ expect(SDLAppInterfaceUnregisteredReasonProtocolViolation).to(equal(@"PROTOCOL_VIOLATION"));
});
});