diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-09-12 11:58:55 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-09-12 11:58:55 -0400 |
commit | 025d4f267462da43d84ed67296039e2926c050a8 (patch) | |
tree | e12750fe7e32dea9b5a17e01b39264d90d6bce33 | |
parent | 19d7f853072c732f3cecbe5198c39e8d4eca83c2 (diff) | |
download | sdl_ios-025d4f267462da43d84ed67296039e2926c050a8.tar.gz |
Handle Play/Pause addition
* Add global for negotiated RPC version
* Add Play/Pause and Okay enums
* Handle play/pause and related RPCs
-rw-r--r-- | SmartDeviceLink/SDLButtonName.h | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLButtonName.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGlobals.h | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGlobals.m | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLProxy.m | 268 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRPCStruct.m | 22 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRegisterAppInterface.m | 8 |
8 files changed, 292 insertions, 28 deletions
diff --git a/SmartDeviceLink/SDLButtonName.h b/SmartDeviceLink/SDLButtonName.h index 32865637c..660274463 100644 --- a/SmartDeviceLink/SDLButtonName.h +++ b/SmartDeviceLink/SDLButtonName.h @@ -18,7 +18,9 @@ typedef SDLEnum SDLButtonName SDL_SWIFT_ENUM; /** * Represents the button usually labeled "OK". A typical use of this button is for the user to press it to make a selection. */ -extern SDLButtonName const SDLButtonNameOk; +extern SDLButtonName const SDLButtonNameOk __deprecated_msg("Use SDLButtonNameOkay or SDLButtonNamePlayPause instead"); + +extern SDLButtonName const SDLButtonNameOkay; /** * Represents the play/pause button for media apps. Replaces "OK" on sub-5.0 head units, compliments it on 5.0 head units and later. diff --git a/SmartDeviceLink/SDLButtonName.m b/SmartDeviceLink/SDLButtonName.m index fe8e1ac33..418cd220e 100644 --- a/SmartDeviceLink/SDLButtonName.m +++ b/SmartDeviceLink/SDLButtonName.m @@ -5,6 +5,7 @@ #import "SDLButtonName.h" SDLButtonName const SDLButtonNameOk = @"OK"; +SDLButtonName const SDLButtonNameOkay = @"OKAY"; SDLButtonName const SDLButtonNamePlayPause = @"PLAY_PAUSE"; SDLButtonName const SDLButtonNameSeekLeft = @"SEEKLEFT"; SDLButtonName const SDLButtonNameSeekRight = @"SEEKRIGHT"; diff --git a/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink/SDLGlobals.h index 5b9220398..ee5b3a259 100644 --- a/SmartDeviceLink/SDLGlobals.h +++ b/SmartDeviceLink/SDLGlobals.h @@ -9,6 +9,7 @@ #import <Foundation/Foundation.h> #import "SDLProtocolHeader.h" +#import "SDLSyncMsgVersion.h" NS_ASSUME_NONNULL_BEGIN @@ -17,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN #define BLOCK_RETURN return extern NSString *const SDLMaxProxyProtocolVersion; +extern NSString *const SDLMaxProxyRPCVersion; extern NSUInteger const SDLDefaultMTUSize; extern NSUInteger const SDLV1MTUSize; @@ -24,9 +26,10 @@ extern NSUInteger const SDLV3MTUSize; @interface SDLGlobals : NSObject -@property (strong, nonatomic, readonly) NSString *protocolVersion; +@property (copy, nonatomic, readonly) NSString *protocolVersion; @property (assign, nonatomic, readonly) NSInteger majorProtocolVersion; -@property (strong, nonatomic) NSString *maxHeadUnitVersion; +@property (copy, nonatomic) SDLSyncMsgVersion *rpcVersion; +@property (copy, nonatomic) NSString *maxHeadUnitVersion; + (instancetype)sharedGlobals; diff --git a/SmartDeviceLink/SDLGlobals.m b/SmartDeviceLink/SDLGlobals.m index 7d63d606c..4e26b5d61 100644 --- a/SmartDeviceLink/SDLGlobals.m +++ b/SmartDeviceLink/SDLGlobals.m @@ -14,20 +14,21 @@ NS_ASSUME_NONNULL_BEGIN // VERSION DEPENDENT CODE NSString *const SDLMaxProxyProtocolVersion = @"5.0.0"; +NSString *const SDLMaxProxyRPCVersion = @"5.0.0"; NSUInteger const SDLDefaultMTUSize = UINT32_MAX; NSUInteger const SDLV1MTUSize = 1024; NSUInteger const SDLV3MTUSize = 131024; -typedef NSNumber* ServiceTypeBox; -typedef NSNumber* MTUBox; +typedef NSNumber *ServiceTypeBox; +typedef NSNumber *MTUBox; @interface SDLGlobals () @property (strong, nonatomic) NSMutableDictionary<ServiceTypeBox, MTUBox> *dynamicMTUDict; -@property (strong, nonatomic, readwrite) NSString *protocolVersion; +@property (copy, nonatomic, readwrite) NSString *protocolVersion; @end @@ -52,6 +53,7 @@ typedef NSNumber* MTUBox; _protocolVersion = @"1.0.0"; _maxHeadUnitVersion = @"0.0.0"; + _rpcVersion = [[SDLSyncMsgVersion alloc] initWithMajorVersion:1 minorVersion:0 patchVersion:0]; _dynamicMTUDict = [NSMutableDictionary dictionary]; return self; diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 33fda76f6..90de7e589 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -22,6 +22,7 @@ #import "SDLFile.h" #import "SDLFileManager.h" #import "SDLFileManagerConfiguration.h" +#import "SDLGlobals.h" #import "SDLLifecycleConfiguration.h" #import "SDLLifecycleConfigurationUpdate.h" #import "SDLLockScreenConfiguration.h" @@ -281,6 +282,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } weakSelf.registerResponse = (SDLRegisterAppInterfaceResponse *)response; + [SDLGlobals sharedGlobals].rpcVersion = weakSelf.registerResponse.syncMsgVersion; [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateRegistered]; }); }]; diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index fa084205d..fab519b11 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -6,7 +6,6 @@ #import <UIKit/UIKit.h> #import <objc/runtime.h> -#import "SDLTransportType.h" #import "SDLAudioStreamingState.h" #import "SDLLogMacros.h" #import "SDLEncodedSyncPData.h" @@ -18,6 +17,8 @@ #import "SDLLanguage.h" #import "SDLLayoutMode.h" #import "SDLLockScreenStatusManager.h" +#import "SDLOnButtonEvent.h" +#import "SDLOnButtonPress.h" #import "SDLOnHMIStatus.h" #import "SDLOnSystemRequest.h" #import "SDLPolicyDataParser.h" @@ -29,10 +30,13 @@ #import "SDLRegisterAppInterfaceResponse.h" #import "SDLRequestType.h" #import "SDLStreamingMediaManager.h" +#import "SDLSubscribeButton.h" #import "SDLSystemContext.h" #import "SDLSystemRequest.h" #import "SDLTCPTransport.h" #import "SDLTimer.h" +#import "SDLTransportType.h" +#import "SDLUnsubscribeButton.h" #import "SDLVehicleType.h" NS_ASSUME_NONNULL_BEGIN @@ -266,8 +270,16 @@ static float DefaultConnectionTimeout = 45.0; } -#pragma mark - Message sending and recieving +#pragma mark - Message sending - (void)sendRPC:(SDLRPCMessage *)message { + if ([message.getFunctionName isEqualToString:@"SubscribeButton"]) { + BOOL handledRPC = [self sdl_adaptButtonSubscribeMessage:(SDLSubscribeButton *)message]; + if (handledRPC) { return; } + } else if ([message.getFunctionName isEqualToString:@"UnsubscribeButton"]) { + BOOL handledRPC = [self sdl_adaptButtonUnsubscribeMessage:(SDLUnsubscribeButton *)message]; + if (handledRPC) { return; } + } + @try { [self.protocol sendRPC:message]; } @catch (NSException *exception) { @@ -275,6 +287,129 @@ static float DefaultConnectionTimeout = 45.0; } } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (BOOL)sdl_adaptButtonSubscribeMessage:(SDLSubscribeButton *)message { + if ([SDLGlobals sharedGlobals].rpcVersion.majorVersion.intValue >= 5) { + if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + SDLSubscribeButton *playPauseMessage = [message copy]; + playPauseMessage.buttonName = SDLButtonNamePlayPause; + + @try { + [self.protocol sendRPC:message]; + [self.protocol sendRPC:playPauseMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOkay]) { + SDLSubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + return NO; + } + } else { + if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + return NO; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOkay]) { + SDLSubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + SDLSubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } + } + + return NO; +} + +- (BOOL)sdl_adaptButtonUnsubscribeMessage:(SDLUnsubscribeButton *)message { + if ([SDLGlobals sharedGlobals].rpcVersion.majorVersion.intValue >= 5) { + if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + SDLUnsubscribeButton *playPauseMessage = [message copy]; + playPauseMessage.buttonName = SDLButtonNamePlayPause; + + @try { + [self.protocol sendRPC:message]; + [self.protocol sendRPC:playPauseMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOkay]) { + SDLUnsubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + return NO; + } + } else { + if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + return NO; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOkay]) { + SDLUnsubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + SDLUnsubscribeButton *okMessage = [message copy]; + okMessage.buttonName = SDLButtonNameOk; + + @try { + [self.protocol sendRPC:okMessage]; + } @catch (NSException *exception) { + SDLLogE(@"Proxy: Failed to send RPC message: %@", message.name); + } + + return YES; + } + } + + return NO; +} +#pragma clang diagnostic pop + +#pragma mark - Message Receiving + - (void)handleProtocolMessage:(SDLProtocolMessage *)incomingMessage { // Convert protocol message to dictionary NSDictionary<NSString *, id> *rpcMessageAsDictionary = [incomingMessage rpcDictionary]; @@ -298,9 +433,6 @@ static float DefaultConnectionTimeout = 45.0; NSString *functionClassName = [NSString stringWithFormat:@"SDL%@", functionName]; SDLRPCMessage *newMessage = [[NSClassFromString(functionClassName) alloc] initWithDictionary:[dict mutableCopy]]; - // Log the RPC message - SDLLogV(@"Message received: %@", newMessage); - // Intercept and handle several messages ourselves if ([functionName isEqualToString:SDLNameOnAppInterfaceUnregistered] || [functionName isEqualToString:SDLNameUnregisterAppInterface]) { [self handleRPCUnregistered:dict]; @@ -322,10 +454,30 @@ static float DefaultConnectionTimeout = 45.0; [self handleSystemRequestResponse:newMessage]; } - // Formulate the name of the method to call and invoke the method on the delegate(s) - NSString *handlerName = [NSString stringWithFormat:@"on%@:", functionName]; - SEL handlerSelector = NSSelectorFromString(handlerName); - [self invokeMethodOnDelegates:handlerSelector withObject:newMessage]; + + if ([functionName isEqualToString:@"OnButtonPress"]) { + SDLOnButtonPress *message = (SDLOnButtonPress *)newMessage; + if ([SDLGlobals sharedGlobals].rpcVersion.majorVersion.intValue >= 5) { + BOOL handledRPC = [self sdl_handleOnButtonPressPostV5:message]; + if (handledRPC) { return; } + } else { // RPC version of 4 or less (connected to an old head unit) + BOOL handledRPC = [self sdl_handleOnButtonPressPreV5:message]; + if (handledRPC) { return; } + } + } + + if ([functionName isEqualToString:@"OnButtonEvent"]) { + SDLOnButtonEvent *message = (SDLOnButtonEvent *)newMessage; + if ([SDLGlobals sharedGlobals].rpcVersion.majorVersion.intValue >= 5) { + BOOL handledRPC = [self sdl_handleOnButtonEventPostV5:message]; + if (handledRPC) { return; } + } else { + BOOL handledRPC = [self sdl_handleOnButtonEventPreV5:message]; + if (handledRPC) { return; } + } + } + + [self sdl_invokeDelegateMethodsWithFunction:functionName message:newMessage]; // When an OnHMIStatus notification comes in, after passing it on (above), generate an "OnLockScreenNotification" if ([functionName isEqualToString:@"OnHMIStatus"]) { @@ -338,6 +490,13 @@ static float DefaultConnectionTimeout = 45.0; } } +- (void)sdl_invokeDelegateMethodsWithFunction:(NSString *)functionName message:(SDLRPCMessage *)message { + // Formulate the name of the method to call and invoke the method on the delegate(s) + NSString *handlerName = [NSString stringWithFormat:@"on%@:", functionName]; + SEL handlerSelector = NSSelectorFromString(handlerName); + [self invokeMethodOnDelegates:handlerSelector withObject:message]; +} + #pragma mark - RPC Handlers @@ -397,6 +556,97 @@ static float DefaultConnectionTimeout = 45.0; SDLLogV(@"SystemRequestResponse to be discarded"); } +#pragma mark BackCompatability ButtonName Helpers + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (BOOL)sdl_handleOnButtonPressPreV5:(SDLOnButtonPress *)message { + // Drop PlayPause, this shouldn't come in + if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + // Send Ok, Okay, and Play/Pause notifications + SDLOnButtonPress *okayPress = [message copy]; + okayPress.buttonName = SDLButtonNameOkay; + + SDLOnButtonPress *playPausePress = [message copy]; + playPausePress.buttonName = SDLButtonNamePlayPause; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okayPress]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:playPausePress]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } + + return NO; +} + +- (BOOL)sdl_handleOnButtonPressPostV5:(SDLOnButtonPress *)message { + if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + // Send PlayPause & OK notifications + SDLOnButtonPress *okPress = [message copy]; + okPress.buttonName = SDLButtonNameOk; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okPress]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + // Send Okay and OK notifications + SDLOnButtonPress *okayPress = [message copy]; + okayPress.buttonName = SDLButtonNameOkay; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okayPress]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } + + return NO; +} + +- (BOOL)sdl_handleOnButtonEventPreV5:(SDLOnButtonEvent *)message { + // Drop PlayPause, this shouldn't come in + if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + // Send Ok, Okay, and Play/Pause notifications + SDLOnButtonEvent *okayEvent = [message copy]; + okayEvent.buttonName = SDLButtonNameOkay; + + SDLOnButtonEvent *playPauseEvent = [message copy]; + playPauseEvent.buttonName = SDLButtonNamePlayPause; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okayEvent]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:playPauseEvent]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } + + return NO; +} + +- (BOOL)sdl_handleOnButtonEventPostV5:(SDLOnButtonEvent *)message { + if ([message.buttonName isEqualToEnum:SDLButtonNamePlayPause]) { + // Send PlayPause & OK notifications + SDLOnButtonEvent *okEvent = [message copy]; + okEvent.buttonName = SDLButtonNameOk; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okEvent]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } else if ([message.buttonName isEqualToEnum:SDLButtonNameOk]) { + // Send Okay and OK notifications + SDLOnButtonEvent *okayEvent = [message copy]; + okayEvent.buttonName = SDLButtonNameOkay; + + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:okayEvent]; + [self sdl_invokeDelegateMethodsWithFunction:message.getFunctionName message:message]; + return YES; + } + + return NO; +} +#pragma clang diagnostic pop + #pragma mark Handle Post-Invoke of Delegate Methods - (void)handleAfterHMIStatus:(SDLRPCMessage *)message { diff --git a/SmartDeviceLink/SDLRPCStruct.m b/SmartDeviceLink/SDLRPCStruct.m index b6a588823..d6a2d8f70 100644 --- a/SmartDeviceLink/SDLRPCStruct.m +++ b/SmartDeviceLink/SDLRPCStruct.m @@ -31,10 +31,10 @@ NS_ASSUME_NONNULL_BEGIN - (NSDictionary<NSString *, id> *)serializeAsDictionary:(Byte)version { if (version >= 2) { - NSString *messageType = [[store keyEnumerator] nextObject]; - NSMutableDictionary<NSString *, id> *function = [store objectForKey:messageType]; + NSString *messageType = store.keyEnumerator.nextObject; + NSMutableDictionary<NSString *, id> *function = store[messageType]; if ([function isKindOfClass:NSMutableDictionary.class]) { - NSMutableDictionary<NSString *, id> *parameters = [function objectForKey:SDLNameParameters]; + NSMutableDictionary<NSString *, id> *parameters = function[SDLNameParameters]; return [self.class sdl_serializeDictionary:parameters version:version]; } else { return [self.class sdl_serializeDictionary:store version:version]; @@ -50,26 +50,26 @@ NS_ASSUME_NONNULL_BEGIN + (NSDictionary<NSString *, id> *)sdl_serializeDictionary:(NSDictionary *)dict version:(Byte)version { NSMutableDictionary<NSString *, id> *ret = [NSMutableDictionary dictionaryWithCapacity:dict.count]; - for (NSString *key in [dict keyEnumerator]) { - NSObject *value = [dict objectForKey:key]; + for (NSString *key in dict.keyEnumerator) { + NSObject *value = dict[key]; if ([value isKindOfClass:SDLRPCStruct.class]) { - [ret setObject:[(SDLRPCStruct *)value serializeAsDictionary:version] forKey:key]; + ret[key] = [(SDLRPCStruct *)value serializeAsDictionary:version]; } else if ([value isKindOfClass:NSDictionary.class]) { - [ret setObject:[self sdl_serializeDictionary:(NSDictionary *)value version:version] forKey:key]; + ret[key] = [self sdl_serializeDictionary:(NSDictionary *)value version:version]; } else if ([value isKindOfClass:NSArray.class]) { NSArray<NSObject *> *arrayVal = (NSArray<NSObject *> *)value; - if (arrayVal.count > 0 && ([[arrayVal objectAtIndex:0] isKindOfClass:SDLRPCStruct.class])) { + if (arrayVal.count > 0 && ([arrayVal.firstObject isKindOfClass:SDLRPCStruct.class])) { NSMutableArray<NSDictionary<NSString *, id> *> *serializedList = [NSMutableArray arrayWithCapacity:arrayVal.count]; for (SDLRPCStruct *serializeable in arrayVal) { [serializedList addObject:[serializeable serializeAsDictionary:version]]; } - [ret setObject:serializedList forKey:key]; + ret[key] = serializedList; } else { - [ret setObject:value forKey:key]; + ret[key] = value; } } else { - [ret setObject:value forKey:key]; + ret[key] = value; } } return ret; diff --git a/SmartDeviceLink/SDLRegisterAppInterface.m b/SmartDeviceLink/SDLRegisterAppInterface.m index 5020d142b..f409119b5 100644 --- a/SmartDeviceLink/SDLRegisterAppInterface.m +++ b/SmartDeviceLink/SDLRegisterAppInterface.m @@ -8,6 +8,7 @@ #import "SDLAppHMIType.h" #import "SDLAppInfo.h" #import "SDLDeviceInfo.h" +#import "SDLGlobals.h" #import "SDLLanguage.h" #import "SDLLifecycleConfiguration.h" #import "SDLNames.h" @@ -52,8 +53,11 @@ NS_ASSUME_NONNULL_BEGIN self.appID = appId; self.languageDesired = languageDesired; self.hmiDisplayLanguageDesired = languageDesired; - - self.syncMsgVersion = [[SDLSyncMsgVersion alloc] initWithMajorVersion:5 minorVersion:0 patchVersion:0]; + + UInt8 majorVersion = (UInt8)[SDLMaxProxyRPCVersion substringWithRange:NSMakeRange(0, 1)].intValue; + UInt8 minorVersion = (UInt8)[SDLMaxProxyRPCVersion substringWithRange:NSMakeRange(2, 1)].intValue; + UInt8 patchVersion = (UInt8)[SDLMaxProxyRPCVersion substringWithRange:NSMakeRange(4, 1)].intValue; + self.syncMsgVersion = [[SDLSyncMsgVersion alloc] initWithMajorVersion:majorVersion minorVersion:minorVersion patchVersion:patchVersion]; self.appInfo = [SDLAppInfo currentAppInfo]; self.deviceInfo = [SDLDeviceInfo currentDevice]; self.correlationID = @1; |