summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLLifecycleManager.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLink/SDLLifecycleManager.m')
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m43
1 files changed, 26 insertions, 17 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index dba15fbdd..78acbec93 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -186,7 +186,9 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
self.registerResponse = nil;
self.lastCorrelationId = 0;
self.hmiLevel = nil;
-
+ self.audioStreamingState = nil;
+ self.systemContext = nil;
+
[SDLDebugTool logInfo:@"Stopping Proxy"];
self.proxy = nil;
@@ -281,8 +283,8 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
NSError *startError = nil;
// If the resultCode isn't success, we got a warning. Errors were handled in `didEnterStateConnected`.
- if (![registerResult isEqualToString:SDLResultSuccess]) {
- startError = [NSError sdl_lifecycle_startedWithBadResult:registerResult info:registerInfo];
+ if (![registerResult isEqualToEnum:SDLResultSuccess]) {
+ startError = [NSError sdl_lifecycle_startedWithWarning:registerResult info:registerInfo];
}
// If we got to this point, we succeeded, send the error if there was a warning.
@@ -401,16 +403,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
return @(++self.lastCorrelationId);
}
-+ (BOOL)sdl_checkNotification:(NSNotification *)notification containsKindOfClass:(Class)class {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class]) {
- return NO;
- }
-
- return YES;
-}
-
-+ (void)sdl_updateLoggingWithFlags : (SDLLogOutput)logFlags {
++ (void)sdl_updateLoggingWithFlags:(SDLLogOutput)logFlags {
if (logFlags == SDLLogOutputNone) {
[SDLDebugTool disable];
return;
@@ -443,25 +436,41 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) {
return;
}
SDLOnHMIStatus *hmiStatusNotification = notification.notification;
SDLHMILevel oldHMILevel = self.hmiLevel;
self.hmiLevel = hmiStatusNotification.hmiLevel;
-
+
+ SDLAudioStreamingState oldStreamingState = self.audioStreamingState;
+ self.audioStreamingState = hmiStatusNotification.audioStreamingState;
+
+ SDLSystemContext oldSystemContext = self.systemContext;
+ self.systemContext = hmiStatusNotification.systemContext;
+
if (![self.lifecycleStateMachine isCurrentState:SDLLifecycleStateReady]) {
return;
}
- if (![oldHMILevel isEqualToString:self.hmiLevel]) {
+ if (![oldHMILevel isEqualToEnum:self.hmiLevel]) {
[self.delegate hmiLevel:oldHMILevel didChangeToLevel:self.hmiLevel];
}
+
+ if (![oldStreamingState isEqualToEnum:self.audioStreamingState]
+ && [self.delegate respondsToSelector:@selector(audioStreamingState:didChangeToState:)]) {
+ [self.delegate audioStreamingState:oldStreamingState didChangeToState:self.audioStreamingState];
+ }
+
+ if (![oldSystemContext isEqualToEnum:self.systemContext]
+ && [self.delegate respondsToSelector:@selector(systemContext:didChangeToContext:)]) {
+ [self.delegate systemContext:oldSystemContext didChangeToContext:self.systemContext];
+ }
}
- (void)remoteHardwareDidUnregister:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnAppInterfaceUnregistered class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnAppInterfaceUnregistered class]]) {
return;
}