summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLLifecycleManager.m
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-08-30 15:21:44 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-08-30 15:21:44 -0400
commita11fe4aa4747ddebddc8c1f97ec7baebd9042914 (patch)
tree317daf2fe3ad97c4c3f17a715c9de4e079ecd57d /SmartDeviceLink/SDLLifecycleManager.m
parent4a117bb0a0e42be31cea320670f1c8588c40b92e (diff)
downloadsdl_ios-a11fe4aa4747ddebddc8c1f97ec7baebd9042914.tar.gz
In progress updates for video service control payloads
* Add initializers to `SDLImageResolution` and `SDLVideoStreamingFormat` structs * Fix abstract protocol startService methods not permitting nil payloads * Fix some documentation on SDLHMICapabilities * Navigation and projection apps now attempt to start streaming on HMI_FULL automatically * Added a streaming media data source protocol developers may implement to alter default runtime behavior, settable in the streaming media configuration * The streaming media manager now takes the full configuration instead of just the data it needs. This expands forward compatibility. * Consolodated `audioStreamingSupported` and `videoStreamingSupported` into `streamingSupported` because you can’t have one without the other * Turned the SMM start block into a hard type and changed it’s naming to “readyHandler” to match the lifecycle manager * In-progress altering of SMM lifecycle to handle pulling capabilities, passing start service parameters and handling retries with alternate settings
Diffstat (limited to 'SmartDeviceLink/SDLLifecycleManager.m')
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m26
1 files changed, 25 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index fc373bffb..b4a98f06f 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -71,6 +71,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
// Private properties
@property (copy, nonatomic) SDLManagerReadyBlock readyHandler;
+@property (assign, nonatomic) BOOL firstHMIFullOccurred;
@end
@@ -104,6 +105,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
_notificationDispatcher = [[SDLNotificationDispatcher alloc] init];
_responseDispatcher = [[SDLResponseDispatcher alloc] initWithNotificationDispatcher:_notificationDispatcher];
_registerResponse = nil;
+ _firstHMIFullOccurred = NO;
// Managers
_fileManager = [[SDLFileManager alloc] initWithConnectionManager:self];
@@ -112,7 +114,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
if ([configuration.lifecycleConfig.appType isEqualToEnum:SDLAppHMITypeNavigation]
|| [configuration.lifecycleConfig.appType isEqualToEnum:SDLAppHMITypeProjection]) {
- _streamManager = [[SDLStreamingMediaManager alloc] initWithConfiguration:configuration.streamingMediaConfig];
+ _streamManager = [[SDLStreamingMediaManager alloc] initWithConnectionManager:self configuration:configuration.streamingMediaConfig];
} else {
SDLLogV(@"Skipping StreamingMediaManager setup due to app type");
}
@@ -310,6 +312,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
// If nil, return and wait until we get a notification
return;
}
+
// We are sure to have a HMIStatus, set state to ready
[self.lifecycleStateMachine transitionToState:SDLLifecycleStateReady];
}
@@ -451,6 +454,23 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
return YES;
}
+- (void)sdl_onFirstHMIFull {
+ // If we are a nav / projection app and desire to stream, we need to be in HMI full and perform additional setup when that occurs
+ if (self.streamManager != nil) {
+ __weak typeof(self) weakSelf = self;
+ [self.streamManager startWithProtocol:self.proxy.protocol completionHandler:^(BOOL success, NSError * _Nullable error) {
+ if (!success) {
+ SDLLogE(@"Streaming media manager was unable to start; error: %@", error);
+ [weakSelf stop];
+ }
+
+ [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateReady];
+ }];
+
+ return;
+ }
+}
+
#pragma mark SDL notification observers
@@ -480,6 +500,10 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
SDLSystemContext oldSystemContext = self.systemContext;
self.systemContext = hmiStatusNotification.systemContext;
+
+ if (!self.firstHMIFullOccurred && [self.hmiLevel isEqualToEnum:SDLHMILevelFull]) {
+ [self sdl_onFirstHMIFull];
+ }
if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateSettingUpHMI]) {
[self.lifecycleStateMachine transitionToState:SDLLifecycleStateReady];