diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-07-28 14:07:05 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-07-28 14:07:05 -0400 |
commit | 8395a62df2a82c251cf8f7ac6ca4aebbe6cb81e6 (patch) | |
tree | b446028a6a0992eef165792294c964ccf6a0f56c | |
parent | ad23c80751e4cf4eedf0fe813d5671ae192e8745 (diff) | |
parent | d49beba0316cf76053c6879303161f54ac039492 (diff) | |
download | sdl_ios-8395a62df2a82c251cf8f7ac6ca4aebbe6cb81e6.tar.gz |
Merge branch 'feature/implement_SDL_0080_multisession_protocol' of https://github.com/jamescs/sdl_ios into jamescs-feature/implement_SDL_0080_multisession_protocol
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGlobals.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLIAPTransport.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink_Example/Info.plist | 1 |
4 files changed, 13 insertions, 4 deletions
@@ -110,6 +110,7 @@ Your application must support a set of smartdevicelink protocol strings in order <string>com.smartdevicelink.prot1</string> <string>com.smartdevicelink.prot0</string> <string>com.ford.sync.prot0</string> +<string>com.smartdevicelink.multisession</string> </array> ``` diff --git a/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink/SDLGlobals.h index fced9d4e9..1c503e619 100644 --- a/SmartDeviceLink/SDLGlobals.h +++ b/SmartDeviceLink/SDLGlobals.h @@ -9,6 +9,7 @@ #import <Foundation/Foundation.h> #define SDL_SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending) +#define SDL_SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] != NSOrderedAscending) #define BLOCK_RETURN return @interface SDLGlobals : NSObject diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m index 3386a298a..eff233f9b 100644 --- a/SmartDeviceLink/SDLIAPTransport.m +++ b/SmartDeviceLink/SDLIAPTransport.m @@ -20,6 +20,7 @@ NSString *const legacyProtocolString = @"com.ford.sync.prot0"; NSString *const controlProtocolString = @"com.smartdevicelink.prot0"; NSString *const indexedProtocolStringPrefix = @"com.smartdevicelink.prot"; +NSString *const multiSessionProtocolString = @"com.smartdevicelink.multisession"; NSString *const backgroundTaskName = @"com.sdl.transport.iap.backgroundTask"; int const createSessionRetries = 1; @@ -187,15 +188,18 @@ int const streamOpenTimeoutSeconds = 2; - (BOOL)sdl_connectAccessory:(EAAccessory *)accessory { BOOL connecting = NO; - - if ([accessory supportsProtocol:controlProtocolString]) { + + if ([accessory supportsProtocol:multiSessionProtocolString] && SDL_SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9")) { + [self sdl_createIAPDataSessionWithAccessory:accessory forProtocol:multiSessionProtocolString]; + connecting = YES; + } else if ([accessory supportsProtocol:controlProtocolString]) { [self sdl_createIAPControlSessionWithAccessory:accessory]; connecting = YES; } else if ([accessory supportsProtocol:legacyProtocolString]) { [self sdl_createIAPDataSessionWithAccessory:accessory forProtocol:legacyProtocolString]; connecting = YES; } - + return connecting; } @@ -212,7 +216,9 @@ int const streamOpenTimeoutSeconds = 2; } // Determine if we can start a multi-app session or a legacy (single-app) session - if ((sdlAccessory = [EAAccessoryManager findAccessoryForProtocol:controlProtocolString])) { + if ((sdlAccessory = [EAAccessoryManager findAccessoryForProtocol:multiSessionProtocolString]) && SDL_SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9")) { + [self sdl_createIAPDataSessionWithAccessory:sdlAccessory forProtocol:multiSessionProtocolString]; + } else if ((sdlAccessory = [EAAccessoryManager findAccessoryForProtocol:controlProtocolString])) { [self sdl_createIAPControlSessionWithAccessory:sdlAccessory]; } else if ((sdlAccessory = [EAAccessoryManager findAccessoryForProtocol:legacyProtocolString])) { [self sdl_createIAPDataSessionWithAccessory:sdlAccessory forProtocol:legacyProtocolString]; diff --git a/SmartDeviceLink_Example/Info.plist b/SmartDeviceLink_Example/Info.plist index 0e9876c4c..6060605cc 100644 --- a/SmartDeviceLink_Example/Info.plist +++ b/SmartDeviceLink_Example/Info.plist @@ -82,6 +82,7 @@ <string>com.smartdevicelink.prot1</string> <string>com.smartdevicelink.prot0</string> <string>com.ford.sync.prot0</string> + <string>com.smartdevicelink.multisession</string> </array> <key>UISupportedInterfaceOrientations</key> <array> |