diff options
Diffstat (limited to 'SmartDeviceLink/SDLLifecycleManager.m')
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 53f2059ac..05a09dd9b 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -244,8 +244,14 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask } else if (self.configuration.lifecycleConfig.allowedSecondaryTransports == SDLSecondaryTransportsNone) { self.proxy = [SDLProxy iapProxyWithListener:self.notificationDispatcher secondaryTransportManager:nil encryptionLifecycleManager:self.encryptionLifecycleManager]; } else { - // We reuse our queue to run secondary transport manager's state machine - self.secondaryTransportManager = [[SDLSecondaryTransportManager alloc] initWithStreamingProtocolDelegate:self serialQueue:self.lifecycleQueue]; + if([self.configuration.lifecycleConfig.appType isEqualToEnum:SDLAppHMITypeNavigation] || + [self.configuration.lifecycleConfig.appType isEqualToEnum:SDLAppHMITypeProjection] || + [self.configuration.lifecycleConfig.additionalAppTypes containsObject:SDLAppHMITypeNavigation] || + [self.configuration.lifecycleConfig.additionalAppTypes containsObject:SDLAppHMITypeProjection]) { + // We reuse our queue to run secondary transport manager's state machine + self.secondaryTransportManager = [[SDLSecondaryTransportManager alloc] initWithStreamingProtocolDelegate:self serialQueue:self.lifecycleQueue]; + } + self.proxy = [SDLProxy iapProxyWithListener:self.notificationDispatcher secondaryTransportManager:self.secondaryTransportManager encryptionLifecycleManager:self.encryptionLifecycleManager]; } #pragma clang diagnostic pop @@ -284,6 +290,7 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask self.lastCorrelationId = 0; self.hmiLevel = nil; self.audioStreamingState = nil; + self.videoStreamingState = nil; self.systemContext = nil; // Due to a race condition internally with EAStream, we cannot immediately attempt to restart the proxy, as we will randomly crash. @@ -529,6 +536,10 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask [self.delegate audioStreamingState:SDLAudioStreamingStateNotAudible didChangeToState:self.audioStreamingState]; } + if ([self.delegate respondsToSelector:@selector(videoStreamingState:didChangetoState:)]) { + [self.delegate videoStreamingState:SDLVideoStreamingStateNotStreamable didChangetoState:self.videoStreamingState]; + } + // Stop the background task now that setup has completed [self.backgroundTaskManager endBackgroundTask]; } @@ -795,9 +806,12 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask SDLHMILevel oldHMILevel = self.hmiLevel; self.hmiLevel = hmiStatusNotification.hmiLevel; - SDLAudioStreamingState oldStreamingState = self.audioStreamingState; + SDLAudioStreamingState oldAudioStreamingState = self.audioStreamingState; self.audioStreamingState = hmiStatusNotification.audioStreamingState; + SDLVideoStreamingState oldVideoStreamingState = self.videoStreamingState; + self.videoStreamingState = hmiStatusNotification.videoStreamingState; + SDLSystemContext oldSystemContext = self.systemContext; self.systemContext = hmiStatusNotification.systemContext; @@ -805,8 +819,12 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask SDLLogD(@"HMI level changed from %@ to %@", oldHMILevel, self.hmiLevel); } - if (![oldStreamingState isEqualToEnum:self.audioStreamingState]) { - SDLLogD(@"Audio streaming state changed from %@ to %@", oldStreamingState, self.audioStreamingState); + if (![oldAudioStreamingState isEqualToEnum:self.audioStreamingState]) { + SDLLogD(@"Audio streaming state changed from %@ to %@", oldAudioStreamingState, self.audioStreamingState); + } + + if (![oldVideoStreamingState isEqualToEnum:self.videoStreamingState]) { + SDLLogD(@"Video streaming state changed from %@ to %@", oldVideoStreamingState, self.videoStreamingState); } if (![oldSystemContext isEqualToEnum:self.systemContext]) { @@ -826,10 +844,16 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask [self.delegate hmiLevel:oldHMILevel didChangeToLevel:self.hmiLevel]; } - if (![oldStreamingState isEqualToEnum:self.audioStreamingState] - && !(oldStreamingState == nil && self.audioStreamingState == nil) + if (![oldAudioStreamingState isEqualToEnum:self.audioStreamingState] + && !(oldAudioStreamingState == nil && self.audioStreamingState == nil) && [self.delegate respondsToSelector:@selector(audioStreamingState:didChangeToState:)]) { - [self.delegate audioStreamingState:oldStreamingState didChangeToState:self.audioStreamingState]; + [self.delegate audioStreamingState:oldAudioStreamingState didChangeToState:self.audioStreamingState]; + } + + if (![oldVideoStreamingState isEqualToEnum:self.videoStreamingState] + && !(oldVideoStreamingState == nil && self.videoStreamingState == nil) + && [self.delegate respondsToSelector:@selector(videoStreamingState:didChangetoState:)]) { + [self.delegate videoStreamingState:oldVideoStreamingState didChangetoState:self.videoStreamingState]; } if (![oldSystemContext isEqualToEnum:self.systemContext] |