summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-07-28 14:33:42 -0400
committerGitHub <noreply@github.com>2017-07-28 14:33:42 -0400
commitd5774c11d56ccfbfdc2582db67a38d81053ae2a0 (patch)
treeb446028a6a0992eef165792294c964ccf6a0f56c
parentad23c80751e4cf4eedf0fe813d5671ae192e8745 (diff)
parentd49beba0316cf76053c6879303161f54ac039492 (diff)
downloadsdl_ios-d5774c11d56ccfbfdc2582db67a38d81053ae2a0.tar.gz
Merge pull request #667 from jamescs/feature/implement_SDL_0080_multisession_protocol
Implement SDL 0080 multisession protocol
-rw-r--r--README.md1
-rw-r--r--SmartDeviceLink/SDLGlobals.h1
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m14
-rw-r--r--SmartDeviceLink_Example/Info.plist1
4 files changed, 13 insertions, 4 deletions
diff --git a/README.md b/README.md
index 145abd9ed..49102a35f 100644
--- a/README.md
+++ b/README.md
@@ -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>