diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2016-05-09 15:15:54 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2016-05-09 15:15:54 -0400 |
commit | 2d6c46229a591a674c7a953513ddf70fdab1b440 (patch) | |
tree | b1081f184408fe5215d9501491f606983cd4ac07 | |
parent | 9c488eed9a2cf8d7cbe53a4f17005f97f3841d3a (diff) | |
download | sdl_ios-2d6c46229a591a674c7a953513ddf70fdab1b440.tar.gz |
Run clang-format over files
33 files changed, 194 insertions, 192 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAddCommand.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAddCommand.m index b0de0f49e..e9630665e 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAddCommand.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAddCommand.m @@ -4,9 +4,9 @@ #import "SDLAddCommand.h" -#import "SDLNames.h" -#import "SDLMenuParams.h" #import "SDLImage.h" +#import "SDLMenuParams.h" +#import "SDLNames.h" @implementation SDLAddCommand diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlert.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlert.m index 35f31b094..ddc7fdc3a 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlert.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlert.m @@ -3,8 +3,8 @@ #import "SDLAlert.h" #import "SDLNames.h" -#import "SDLTTSChunk.h" #import "SDLSoftButton.h" +#import "SDLTTSChunk.h" @implementation SDLAlert diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlertManeuver.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlertManeuver.m index 6223c7dac..81717506f 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlertManeuver.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAlertManeuver.m @@ -5,8 +5,8 @@ #import "SDLAlertManeuver.h" #import "SDLNames.h" -#import "SDLTTSChunk.h" #import "SDLSoftButton.h" +#import "SDLTTSChunk.h" @implementation SDLAlertManeuver diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLChangeRegistration.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLChangeRegistration.m index 5ea0f733f..00a7de885 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLChangeRegistration.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLChangeRegistration.m @@ -4,8 +4,8 @@ #import "SDLChangeRegistration.h" -#import "SDLNames.h" #import "SDLLanguage.h" +#import "SDLNames.h" @implementation SDLChangeRegistration diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLCreateInteractionChoiceSet.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLCreateInteractionChoiceSet.m index b4c32df5e..32324d46e 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLCreateInteractionChoiceSet.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLCreateInteractionChoiceSet.m @@ -4,8 +4,8 @@ #import "SDLCreateInteractionChoiceSet.h" -#import "SDLNames.h" #import "SDLChoice.h" +#import "SDLNames.h" @implementation SDLCreateInteractionChoiceSet diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.h index 41e6fbc5b..0e487303b 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.h +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.h @@ -2,8 +2,8 @@ // -#import <Foundation/Foundation.h> #import "SDLDebugToolConsole.h" +#import <Foundation/Foundation.h> @class SDLRPCMessage; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.m index b2222a7ca..1f0312c9c 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLDebugTool.m @@ -2,10 +2,10 @@ // #import "SDLDebugTool.h" +#import "NSThread+ThreadIndex.h" +#import "SDLHexUtility.h" #import "SDLRPCMessage.h" #import "SDLSiphonServer.h" -#import "SDLHexUtility.h" -#import "NSThread+ThreadIndex.h" #define LOG_ERROR_ENABLED @@ -29,10 +29,10 @@ if (!self) { return nil; } - + _debugToLogFile = NO; _logQueue = dispatch_queue_create("com.sdl.log.file", DISPATCH_QUEUE_SERIAL); - + return self; } @@ -42,7 +42,7 @@ dispatch_once(&onceToken, ^{ sharedTool = [[self.class alloc] init]; }); - + return sharedTool; } @@ -161,19 +161,19 @@ - (void)sdl_enableDebugToLogFile { [SDLDebugTool logInfo:@"Enabling Log File" withType:SDLDebugType_Debug]; - + self.debugToLogFile = YES; - + //Delete Log File If It Exists NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"smartdevicelink.log"]; - + NSFileManager *manager = [NSFileManager defaultManager]; if ([manager fileExistsAtPath:filePath]) { [manager removeItemAtPath:filePath error:nil]; } - + // Create log file [manager createFileAtPath:filePath contents:nil attributes:nil]; self.logFileHandle = [NSFileHandle fileHandleForWritingAtPath:filePath]; @@ -197,16 +197,16 @@ if (!self.debugToLogFile || info == NULL || info.length == 0) { return; } - + dispatch_async(self.logQueue, ^{ // Create timestamp string, add it in front of the message to be logged NSDate *currentDate = [NSDate date]; NSString *dateString = [self.logDateFormatter stringFromDate:currentDate]; NSString *outputString = [dateString stringByAppendingFormat:@": %@\n", info]; - + // File write takes an NSData, so convert string to data. NSData *dataToLog = [outputString dataUsingEncoding:NSUTF8StringEncoding]; - + if (self.logFileHandle != nil) { [self.logFileHandle seekToEndOfFile]; [self.logFileHandle writeData:dataToLog]; @@ -221,7 +221,7 @@ _logDateFormatter = [[NSDateFormatter alloc] init]; [_logDateFormatter setDateFormat:@"MM/dd/YY HH:mm:ss.SSS"]; } - + return _logDateFormatter; } diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h index b3778f62e..2b6fe2c47 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h @@ -8,7 +8,7 @@ #import <Foundation/Foundation.h> -#define SDL_SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending) +#define SDL_SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending) @interface SDLGlobals : NSObject diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLHMIPermissions.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLHMIPermissions.m index 1876a7137..29555bf59 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLHMIPermissions.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLHMIPermissions.m @@ -4,8 +4,8 @@ #import "SDLHMIPermissions.h" -#import "SDLNames.h" #import "SDLHMILevel.h" +#import "SDLNames.h" @implementation SDLHMIPermissions diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.h index 5a1251fda..d21343894 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.h +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.h @@ -2,9 +2,9 @@ // SDLIAPSession.h // -#import <Foundation/Foundation.h> -#import <ExternalAccessory/ExternalAccessory.h> #import "SDLIAPSessionDelegate.h" +#import <ExternalAccessory/ExternalAccessory.h> +#import <Foundation/Foundation.h> @class SDLStreamDelegate; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.m index 131885965..5020b2081 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPSession.m @@ -2,10 +2,10 @@ // SDLIAPSession.m // -#import "SDLDebugTool.h" #import "SDLIAPSession.h" -#import "SDLTimer.h" +#import "SDLDebugTool.h" #import "SDLStreamDelegate.h" +#import "SDLTimer.h" @interface SDLIAPSession () @@ -48,7 +48,7 @@ if ((self.easession = [[EASession alloc] initWithAccessory:_accessory forProtocol:_protocol])) { __strong typeof(self) strongSelf = weakSelf; - + [SDLDebugTool logInfo:@"Created Session Object"]; strongSelf.streamDelegate.streamErrorHandler = [self streamErroredHandler]; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPTransport.m index e7ba64962..5cf4ceb21 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPTransport.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLIAPTransport.m @@ -5,15 +5,15 @@ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> -#import "SDLIAPTransport.h" +#import "EAAccessoryManager+SDLProtocols.h" #import "SDLDebugTool.h" #import "SDLGlobals.h" -#import "SDLSiphonServer.h" +#import "SDLIAPSession.h" #import "SDLIAPTransport.h" +#import "SDLIAPTransport.h" +#import "SDLSiphonServer.h" #import "SDLStreamDelegate.h" -#import "EAAccessoryManager+SDLProtocols.h" #import "SDLTimer.h" -#import "SDLIAPSession.h" #import <CommonCrypto/CommonDigest.h> @@ -180,7 +180,7 @@ int const streamOpenTimeoutSeconds = 2; __weak typeof(self) weakSelf = self; void (^elapsedBlock)(void) = ^{ __strong typeof(weakSelf) strongSelf = weakSelf; - + [SDLDebugTool logInfo:@"Protocol Index Timeout"]; [strongSelf.controlSession stop]; strongSelf.controlSession.streamDelegate = nil; @@ -418,37 +418,37 @@ int const streamOpenTimeoutSeconds = 2; const double min_value = 0.0; const double max_value = 10.0; double range_length = max_value - min_value; - + static double delay = 0; - + // HAX: This pull the app name and hashes it in an attempt to provide a more even distribution of retry delays. The evidence that this does so is anecdotal. A more ideal solution would be to use a list of known, installed SDL apps on the phone to try and deterministically generate an even delay. if (delay == 0) { NSString *appName = [[NSProcessInfo processInfo] processName]; if (appName == nil) { appName = @"noname"; } - + // Run the app name through an md5 hasher const char *ptr = [appName UTF8String]; unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH]; CC_MD5(ptr, (unsigned int)strlen(ptr), md5Buffer); - + // Generate a string of the hex hash NSMutableString *output = [NSMutableString stringWithString:@"0x"]; for (int i = 0; i < 8; i++) { [output appendFormat:@"%02X", md5Buffer[i]]; } - + // Transform the string into a number between 0 and 1 unsigned long long firstHalf; NSScanner *pScanner = [NSScanner scannerWithString:output]; [pScanner scanHexLongLong:&firstHalf]; double hashBasedValueInRange0to1 = ((double)firstHalf) / 0xffffffffffffffff; - + // Transform the number into a number between min and max delay = ((range_length * hashBasedValueInRange0to1) + min_value); } - + return delay; } diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnButtonEvent.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnButtonEvent.m index c8d9797f2..d112d88ea 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnButtonEvent.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLOnButtonEvent.m @@ -3,8 +3,8 @@ #import "SDLOnButtonEvent.h" -#import "SDLButtonName.h" #import "SDLButtonEventMode.h" +#import "SDLButtonName.h" #import "SDLNames.h" diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLPerformInteraction.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLPerformInteraction.m index f5eec2fa9..de6c3622f 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLPerformInteraction.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLPerformInteraction.m @@ -4,9 +4,9 @@ #import "SDLPerformInteraction.h" -#import "SDLNames.h" #import "SDLInteractionMode.h" #import "SDLLayoutMode.h" +#import "SDLNames.h" #import "SDLTTSChunk.h" #import "SDLVRHelpItem.h" diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m index cee0d7791..bb6db1814 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m @@ -2,24 +2,24 @@ // -#import "SDLJsonEncoder.h" #import "SDLFunctionID.h" +#import "SDLJsonEncoder.h" +#import "SDLAbstractTransport.h" +#import "SDLDebugTool.h" #import "SDLGlobals.h" -#import "SDLRPCRequest.h" +#import "SDLPrioritizedObjectCollection.h" #import "SDLProtocol.h" #import "SDLProtocolHeader.h" #import "SDLProtocolMessage.h" -#import "SDLV2ProtocolHeader.h" #import "SDLProtocolMessageDisassembler.h" #import "SDLProtocolReceivedMessageRouter.h" -#import "SDLRPCPayload.h" -#import "SDLDebugTool.h" -#import "SDLPrioritizedObjectCollection.h" #import "SDLRPCNotification.h" +#import "SDLRPCPayload.h" +#import "SDLRPCRequest.h" #import "SDLRPCResponse.h" -#import "SDLAbstractTransport.h" #import "SDLTimer.h" +#import "SDLV2ProtocolHeader.h" @interface SDLProtocol () { @@ -324,7 +324,7 @@ - (void)handleProtocolEndSessionACK:(SDLServiceType)serviceType { // Remove the session id [self sdl_removeSessionIdForServiceType:serviceType]; - + for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) { if ([listener respondsToSelector:@selector(handleProtocolEndSessionACK:)]) { [listener handleProtocolEndSessionACK:serviceType]; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessage.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessage.m index e96c61455..f68810123 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessage.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessage.m @@ -2,12 +2,12 @@ // -#import "SDLProtocolHeader.h" #import "SDLProtocolMessage.h" +#import "SDLFunctionID.h" +#import "SDLProtocolHeader.h" +#import "SDLRPCPayload.h" #import "SDLV1ProtocolMessage.h" #import "SDLV2ProtocolMessage.h" -#import "SDLRPCPayload.h" -#import "SDLFunctionID.h" @interface SDLProtocolMessage () diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessageDisassembler.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessageDisassembler.m index 3fa82c9f6..76d722956 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessageDisassembler.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolMessageDisassembler.m @@ -1,9 +1,9 @@ // SDLProtocolMessageDisassembler.m // +#import "SDLProtocolMessageDisassembler.h" #import "SDLProtocolHeader.h" #import "SDLProtocolMessage.h" -#import "SDLProtocolMessageDisassembler.h" @implementation SDLProtocolMessageDisassembler diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolReceivedMessageRouter.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolReceivedMessageRouter.m index fb72e9b0d..5ea7c6e63 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolReceivedMessageRouter.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocolReceivedMessageRouter.m @@ -4,9 +4,9 @@ // This class gets handed the SDLProtocol messages as they are received and decides what happens to them and where they are sent on to. #import "SDLProtocolReceivedMessageRouter.h" +#import "SDLDebugTool.h" #import "SDLProtocolMessage.h" #import "SDLProtocolMessageAssembler.h" -#import "SDLDebugTool.h" @interface SDLProtocolReceivedMessageRouter () diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m index ed9ca1678..0e06aae12 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m @@ -2,8 +2,8 @@ #import "SDLProxy.h" -#import <UIKit/UIKit.h> #import <ExternalAccessory/ExternalAccessory.h> +#import <UIKit/UIKit.h> #import <objc/runtime.h> #import "SDLAbstractTransport.h" @@ -19,25 +19,25 @@ #import "SDLLanguage.h" #import "SDLLayoutMode.h" #import "SDLLockScreenManager.h" +#import "SDLLockScreenManager.h" #import "SDLNames.h" #import "SDLOnHMIStatus.h" #import "SDLOnSystemRequest.h" #import "SDLPolicyDataParser.h" +#import "SDLPolicyDataParser.h" #import "SDLProtocol.h" #import "SDLProtocolMessage.h" +#import "SDLProtocolMessage.h" #import "SDLPutFile.h" -#import "SDLRequestType.h" +#import "SDLRPCPayload.h" #import "SDLRPCPayload.h" #import "SDLRPCRequestFactory.h" #import "SDLRPCResponse.h" +#import "SDLRequestType.h" #import "SDLSiphonServer.h" #import "SDLStreamingMediaManager.h" #import "SDLSystemContext.h" #import "SDLSystemRequest.h" -#import "SDLRPCPayload.h" -#import "SDLPolicyDataParser.h" -#import "SDLLockScreenManager.h" -#import "SDLProtocolMessage.h" #import "SDLTimer.h" #import "SDLURLSession.h" @@ -69,35 +69,35 @@ const int POLICIES_CORRELATION_ID = 65535; _debugConsoleGroupName = @"default"; _lsm = [[SDLLockScreenManager alloc] init]; _alreadyDestructed = NO; - + _mutableProxyListeners = [NSMutableSet setWithObject:theDelegate]; _protocol = protocol; _transport = transport; _transport.delegate = protocol; [_protocol.protocolDelegateTable addObject:self]; _protocol.transport = transport; - + [self.transport connect]; - + [SDLDebugTool logInfo:@"SDLProxy initWithTransport"]; [[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications]; } - + return self; } - (void)destructObjects { if (!_alreadyDestructed) { _alreadyDestructed = YES; - + [[NSNotificationCenter defaultCenter] removeObserver:self]; [[EAAccessoryManager sharedAccessoryManager] unregisterForLocalNotifications]; - + [[SDLURLSession defaultSession] cancelAllTasks]; - + [self.protocol dispose]; [self.transport dispose]; - + _transport = nil; _protocol = nil; _mutableProxyListeners = nil; @@ -108,7 +108,7 @@ const int POLICIES_CORRELATION_ID = 65535; if (self.transport != nil) { [self.transport disconnect]; } - + [self destructObjects]; } @@ -135,10 +135,10 @@ const int POLICIES_CORRELATION_ID = 65535; - (void)sendMobileHMIState { UIApplicationState appState = [UIApplication sharedApplication].applicationState; SDLOnHMIStatus *HMIStatusRPC = [[SDLOnHMIStatus alloc] init]; - + HMIStatusRPC.audioStreamingState = [SDLAudioStreamingState NOT_AUDIBLE]; HMIStatusRPC.systemContext = [SDLSystemContext MAIN]; - + switch (appState) { case UIApplicationStateActive: { HMIStatusRPC.hmiLevel = [SDLHMILevel FULL]; @@ -150,10 +150,10 @@ const int POLICIES_CORRELATION_ID = 65535; default: break; } - + NSString *log = [NSString stringWithFormat:@"Sending new mobile hmi state: %@", HMIStatusRPC.hmiLevel.value]; [SDLDebugTool logInfo:log withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + [self sendRPC:HMIStatusRPC]; } @@ -169,7 +169,7 @@ const int POLICIES_CORRELATION_ID = 65535; _streamingMediaManager = [[SDLStreamingMediaManager alloc] initWithProtocol:self.protocol]; [self.protocol.protocolDelegateTable addObject:_streamingMediaManager]; } - + return _streamingMediaManager; } @@ -178,9 +178,9 @@ const int POLICIES_CORRELATION_ID = 65535; - (void)onProtocolOpened { _isConnected = YES; [SDLDebugTool logInfo:@"StartSession (request)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + [self.protocol sendStartSessionWithType:SDLServiceType_RPC]; - + if (self.startSessionTimer == nil) { self.startSessionTimer = [[SDLTimer alloc] initWithDuration:startSessionTime repeat:NO]; __weak typeof(self) weakSelf = self; @@ -203,7 +203,7 @@ const int POLICIES_CORRELATION_ID = 65535; - (void)handleProtocolStartSessionACK:(SDLServiceType)serviceType sessionID:(Byte)sessionID version:(Byte)version { // Turn off the timer, the start session response came back [self.startSessionTimer cancel]; - + NSString *logMessage = [NSString stringWithFormat:@"StartSession (response)\nSessionId: %d for serviceType %d", sessionID, serviceType]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; @@ -248,7 +248,7 @@ const int POLICIES_CORRELATION_ID = 65535; SDLRPCMessage *message = [[SDLRPCMessage alloc] initWithDictionary:[dict mutableCopy]]; NSString *functionName = [message getFunctionName]; NSString *messageType = [message messageType]; - + // If it's a response, append response if ([messageType isEqualToString:NAMES_response]) { BOOL notGenericResponseMessage = ![functionName isEqualToString:@"GenericResponse"]; @@ -256,50 +256,50 @@ const int POLICIES_CORRELATION_ID = 65535; functionName = [NSString stringWithFormat:@"%@Response", functionName]; } } - + // From the function name, create the corresponding RPCObject and initialize it NSString *functionClassName = [NSString stringWithFormat:@"SDL%@", functionName]; SDLRPCMessage *newMessage = [[NSClassFromString(functionClassName) alloc] initWithDictionary:[dict mutableCopy]]; - + // Log the RPC message NSString *logMessage = [NSString stringWithFormat:@"%@", newMessage]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + // Intercept and handle several messages ourselves if ([functionName isEqualToString:NAMES_OnAppInterfaceUnregistered] || [functionName isEqualToString:NAMES_UnregisterAppInterface]) { [self handleRPCUnregistered:dict]; } - + if ([functionName isEqualToString:@"RegisterAppInterfaceResponse"]) { [self handleRegisterAppInterfaceResponse:(SDLRPCResponse *)newMessage]; } - + if ([functionName isEqualToString:@"EncodedSyncPDataResponse"]) { [SDLDebugTool logInfo:@"EncodedSyncPData (response)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; } - + if ([functionName isEqualToString:@"OnEncodedSyncPData"]) { [self handleSyncPData:newMessage]; } - + if ([functionName isEqualToString:@"OnSystemRequest"]) { [self handleSystemRequest:dict]; } - + if ([functionName isEqualToString:@"SystemRequestResponse"]) { [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]; - + // When an OnHMIStatus notification comes in, after passing it on (above), generate an "OnLockScreenNotification" if ([functionName isEqualToString:@"OnHMIStatus"]) { [self handleAfterHMIStatus:newMessage]; } - + // When an OnDriverDistraction notification comes in, after passing it on (above), generate an "OnLockScreenNotification" if ([functionName isEqualToString:@"OnDriverDistraction"]) { [self handleAfterDriverDistraction:newMessage]; @@ -334,11 +334,11 @@ const int POLICIES_CORRELATION_ID = 65535; // If URL != nil, perform HTTP Post and don't pass the notification to proxy listeners NSString *logMessage = [NSString stringWithFormat:@"OnEncodedSyncPData (notification)\n%@", message]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + NSString *urlString = (NSString *)[message getParameters:@"URL"]; NSDictionary *encodedSyncPData = (NSDictionary *)[message getParameters:@"data"]; NSNumber *encodedSyncPTimeout = (NSNumber *)[message getParameters:@"Timeout"]; - + if (urlString && encodedSyncPData && encodedSyncPTimeout) { [self sendEncodedSyncPData:encodedSyncPData toURL:urlString withTimeout:encodedSyncPTimeout]; } @@ -346,10 +346,10 @@ const int POLICIES_CORRELATION_ID = 65535; - (void)handleSystemRequest:(NSDictionary *)dict { [SDLDebugTool logInfo:@"OnSystemRequest (notification)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + SDLOnSystemRequest *systemRequest = [[SDLOnSystemRequest alloc] initWithDictionary:[dict mutableCopy]]; SDLRequestType *requestType = systemRequest.requestType; - + // Handle the various OnSystemRequest types if (requestType == [SDLRequestType PROPRIETARY]) { [self handleSystemRequestProprietary:systemRequest]; @@ -373,7 +373,7 @@ const int POLICIES_CORRELATION_ID = 65535; NSString *statusString = (NSString *)[message getParameters:NAMES_hmiLevel]; SDLHMILevel *hmiLevel = [SDLHMILevel valueOf:statusString]; _lsm.hmiLevel = hmiLevel; - + SEL callbackSelector = NSSelectorFromString(@"onOnLockScreenNotification:"); [self invokeMethodOnDelegates:callbackSelector withObject:_lsm.lockScreenStatusNotification]; } @@ -382,7 +382,7 @@ const int POLICIES_CORRELATION_ID = 65535; NSString *stateString = (NSString *)[message getParameters:NAMES_state]; BOOL state = [stateString isEqualToString:@"DD_ON"] ? YES : NO; _lsm.driverDistracted = state; - + SEL callbackSelector = NSSelectorFromString(@"onOnLockScreenNotification:"); [self invokeMethodOnDelegates:callbackSelector withObject:_lsm.lockScreenStatusNotification]; } @@ -395,7 +395,7 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:[NSString stringWithFormat:@"Launch App failure: invalid URL sent from module: %@", request.url] withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - // If system version is less than 9.0 http://stackoverflow.com/a/5337804/1370927 + // If system version is less than 9.0 http://stackoverflow.com/a/5337804/1370927 if (SDL_SYSTEM_VERSION_LESS_THAN(@"9.0")) { // Return early if we can't openURL because openURL will crash instead of fail silently in < 9.0 if (![[UIApplication sharedApplication] canOpenURL:URLScheme]) { @@ -410,11 +410,11 @@ const int POLICIES_CORRELATION_ID = 65535; if (JSONDictionary == nil || request.url == nil) { return; } - + NSDictionary *requestData = JSONDictionary[@"HTTPRequest"]; NSString *bodyString = requestData[@"body"]; NSData *bodyData = [bodyString dataUsingEncoding:NSUTF8StringEncoding]; - + // Parse and display the policy data. SDLPolicyDataParser *pdp = [[SDLPolicyDataParser alloc] init]; NSData *policyData = [pdp unwrap:bodyData]; @@ -423,33 +423,33 @@ const int POLICIES_CORRELATION_ID = 65535; NSString *logMessage = [NSString stringWithFormat:@"Policy Data from Module\n%@", pdp]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; } - + // Send the HTTP Request [self uploadForBodyDataDictionary:JSONDictionary URLString:request.url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSString *logMessage = nil; - + if (error) { logMessage = [NSString stringWithFormat:@"OnSystemRequest (HTTP response) = ERROR: %@", error]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - + if (data == nil || data.length == 0) { [SDLDebugTool logInfo:@"OnSystemRequest (HTTP response) failure: no data returned" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - + // Show the HTTP response [SDLDebugTool logInfo:@"OnSystemRequest (HTTP response)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + // Create the SystemRequest RPC to send to module. SDLSystemRequest *request = [[SDLSystemRequest alloc] init]; request.correlationID = [NSNumber numberWithInt:POLICIES_CORRELATION_ID]; request.requestType = [SDLRequestType PROPRIETARY]; request.bulkData = data; - + // Parse and display the policy data. SDLPolicyDataParser *pdp = [[SDLPolicyDataParser alloc] init]; NSData *policyData = [pdp unwrap:data]; @@ -458,7 +458,7 @@ const int POLICIES_CORRELATION_ID = 65535; logMessage = [NSString stringWithFormat:@"Policy Data from Cloud\n%@", pdp]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; } - + // Send and log RPC Request logMessage = [NSString stringWithFormat:@"SystemRequest (request)\n%@\nData length=%lu", [request serializeAsDictionary:2], (unsigned long)data.length]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; @@ -474,7 +474,7 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - + UIImage *icon = [UIImage imageWithData:data]; [self invokeMethodOnDelegates:@selector(onReceivedLockScreenIcon:) withObject:icon]; }]; @@ -485,36 +485,38 @@ const int POLICIES_CORRELATION_ID = 65535; // TODO: not sure how we want to handle http requests that don't have bulk data (maybe as GET?) return; } - - [self sdl_uploadData:request.bulkData toURLString:request.url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - NSString *logMessage = nil; - if (error != nil) { - logMessage = [NSString stringWithFormat:@"OnSystemRequest (HTTP response) = ERROR: %@", error.localizedDescription]; + + [self sdl_uploadData:request.bulkData + toURLString:request.url + completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + NSString *logMessage = nil; + if (error != nil) { + logMessage = [NSString stringWithFormat:@"OnSystemRequest (HTTP response) = ERROR: %@", error.localizedDescription]; + [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; + return; + } + + if (data.length == 0) { + [SDLDebugTool logInfo:@"OnSystemRequest (HTTP response) failure: no data returned" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; + return; + } + + // Show the HTTP response + NSString *responseLogString = [NSString stringWithFormat:@"OnSystemRequest (HTTP) response: %@", response]; + [SDLDebugTool logInfo:responseLogString withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; + + // Create the SystemRequest RPC to send to module. + SDLPutFile *putFile = [[SDLPutFile alloc] init]; + putFile.fileType = [SDLFileType JSON]; + putFile.correlationID = @(POLICIES_CORRELATION_ID); + putFile.syncFileName = @"response_data"; + putFile.bulkData = data; + + // Send and log RPC Request + logMessage = [NSString stringWithFormat:@"SystemRequest (request)\n%@\nData length=%lu", [request serializeAsDictionary:2], (unsigned long)data.length]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - return; - } - - if (data.length == 0) { - [SDLDebugTool logInfo:@"OnSystemRequest (HTTP response) failure: no data returned" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - return; - } - - // Show the HTTP response - NSString *responseLogString = [NSString stringWithFormat:@"OnSystemRequest (HTTP) response: %@", response]; - [SDLDebugTool logInfo:responseLogString withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - - // Create the SystemRequest RPC to send to module. - SDLPutFile *putFile = [[SDLPutFile alloc] init]; - putFile.fileType = [SDLFileType JSON]; - putFile.correlationID = @(POLICIES_CORRELATION_ID); - putFile.syncFileName = @"response_data"; - putFile.bulkData = data; - - // Send and log RPC Request - logMessage = [NSString stringWithFormat:@"SystemRequest (request)\n%@\nData length=%lu", [request serializeAsDictionary:2], (unsigned long)data.length]; - [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - [self sendRPC:putFile]; - }]; + [self sendRPC:putFile]; + }]; } /** @@ -527,18 +529,18 @@ const int POLICIES_CORRELATION_ID = 65535; - (NSDictionary *)validateAndParseSystemRequest:(SDLOnSystemRequest *)request { NSString *urlString = request.url; SDLFileType *fileType = request.fileType; - + // Validate input if (urlString == nil || [NSURL URLWithString:urlString] == nil) { [SDLDebugTool logInfo:@"OnSystemRequest (notification) failure: url is nil" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return nil; } - + if (fileType != [SDLFileType JSON]) { [SDLDebugTool logInfo:@"OnSystemRequest (notification) failure: file type is not JSON" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return nil; } - + // Get data dictionary from the bulkData NSError *error = nil; NSDictionary *JSONDictionary = [NSJSONSerialization JSONObjectWithData:request.bulkData options:kNilOptions error:&error]; @@ -546,7 +548,7 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:@"OnSystemRequest failure: notification data is not valid JSON." withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return nil; } - + return JSONDictionary; } @@ -557,17 +559,17 @@ const int POLICIES_CORRELATION_ID = 65535; * @param urlString The URL the data should be POSTed to * @param completionHandler A completion handler of what to do when the server responds */ -- (void)sdl_uploadData:(NSData * _Nonnull)data toURLString:(NSString * _Nonnull)urlString completionHandler:(URLSessionTaskCompletionHandler _Nullable)completionHandler { +- (void)sdl_uploadData:(NSData *_Nonnull)data toURLString:(NSString *_Nonnull)urlString completionHandler:(URLSessionTaskCompletionHandler _Nullable)completionHandler { // NSURLRequest configuration NSURL *url = [NSURL URLWithString:urlString]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setValue:@"application/json" forHTTPHeaderField:@"content-type"]; request.HTTPMethod = @"POST"; - + // Logging NSString *logMessage = [NSString stringWithFormat:@"OnSystemRequest (HTTP Request) to URL %@", urlString]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + // Create the upload task [[SDLURLSession defaultSession] uploadWithURLRequest:request data:data completionHandler:completionHandler]; } @@ -583,7 +585,7 @@ const int POLICIES_CORRELATION_ID = 65535; NSParameterAssert(dictionary != nil); NSParameterAssert(urlString != nil); NSParameterAssert(completionHandler != NULL); - + // Extract data from the dictionary NSDictionary *requestData = dictionary[@"HTTPRequest"]; NSDictionary *headers = requestData[@"headers"]; @@ -592,18 +594,18 @@ const int POLICIES_CORRELATION_ID = 65535; NSString *method = headers[@"RequestMethod"]; NSString *bodyString = requestData[@"body"]; NSData *bodyData = [bodyString dataUsingEncoding:NSUTF8StringEncoding]; - + // NSURLRequest configuration NSURL *url = [NSURL URLWithString:urlString]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setValue:contentType forHTTPHeaderField:@"content-type"]; request.timeoutInterval = timeout; request.HTTPMethod = method; - + // Logging NSString *logMessage = [NSString stringWithFormat:@"OnSystemRequest (HTTP Request) to URL %@", urlString]; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + // Create the upload task [[SDLURLSession defaultSession] uploadWithURLRequest:request data:bodyData completionHandler:completionHandler]; } @@ -646,7 +648,7 @@ const int POLICIES_CORRELATION_ID = 65535; request.HTTPMethod = @"POST"; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; request.timeoutInterval = 60; - + // Prepare the data in the required format NSString *encodedSyncPDataString = [[NSString stringWithFormat:@"%@", encodedSyncPData] componentsSeparatedByString:@"\""][1]; NSArray *array = [NSArray arrayWithObject:encodedSyncPDataString]; @@ -658,14 +660,14 @@ const int POLICIES_CORRELATION_ID = 65535; [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - + // Send the HTTP Request [[SDLURLSession defaultSession] uploadWithURLRequest:request data:data completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { [self syncPDataNetworkRequestCompleteWithData:data response:response error:error]; }]; - + [SDLDebugTool logInfo:@"OnEncodedSyncPData (HTTP request)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; } @@ -673,13 +675,13 @@ const int POLICIES_CORRELATION_ID = 65535; - (void)syncPDataNetworkRequestCompleteWithData:(NSData *)data response:(NSURLResponse *)response error:(NSError *)error { // Sample of response: {"data":["SDLKGLSDKFJLKSjdslkfjslkJLKDSGLKSDJFLKSDJF"]} [SDLDebugTool logInfo:@"OnEncodedSyncPData (HTTP response)" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; - + // Validate response data. if (data == nil || data.length == 0) { [SDLDebugTool logInfo:@"OnEncodedSyncPData (HTTP response) failure: no data returned" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName]; return; } - + // Convert data to RPCRequest NSError *JSONConversionError = nil; NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&JSONConversionError]; @@ -687,7 +689,7 @@ const int POLICIES_CORRELATION_ID = 65535; SDLEncodedSyncPData *request = [[SDLEncodedSyncPData alloc] init]; request.correlationID = [NSNumber numberWithInt:POLICIES_CORRELATION_ID]; request.data = [responseDictionary objectForKey:@"data"]; - + [self sendRPC:request]; } } @@ -698,7 +700,7 @@ const int POLICIES_CORRELATION_ID = 65535; inputStream.delegate = self; objc_setAssociatedObject(inputStream, @"SDLPutFile", putFileRPCRequest, OBJC_ASSOCIATION_RETAIN); objc_setAssociatedObject(inputStream, @"BaseOffset", [putFileRPCRequest offset], OBJC_ASSOCIATION_RETAIN); - + [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; } @@ -708,29 +710,29 @@ const int POLICIES_CORRELATION_ID = 65535; case NSStreamEventHasBytesAvailable: { // Grab some bytes from the stream and send them in a SDLPutFile RPC Request NSUInteger currentStreamOffset = [[stream propertyForKey:NSStreamFileCurrentOffsetKey] unsignedIntegerValue]; - + NSMutableData *buffer = [NSMutableData dataWithLength:[SDLGlobals globals].maxMTUSize]; NSUInteger nBytesRead = [(NSInputStream *)stream read:(uint8_t *)buffer.mutableBytes maxLength:buffer.length]; if (nBytesRead > 0) { NSData *data = [buffer subdataWithRange:NSMakeRange(0, nBytesRead)]; NSUInteger baseOffset = [(NSNumber *)objc_getAssociatedObject(stream, @"BaseOffset") unsignedIntegerValue]; NSUInteger newOffset = baseOffset + currentStreamOffset; - + SDLPutFile *putFileRPCRequest = (SDLPutFile *)objc_getAssociatedObject(stream, @"SDLPutFile"); [putFileRPCRequest setOffset:[NSNumber numberWithUnsignedInteger:newOffset]]; [putFileRPCRequest setLength:[NSNumber numberWithUnsignedInteger:nBytesRead]]; [putFileRPCRequest setBulkData:data]; - + [self sendRPC:putFileRPCRequest]; } - + break; } case NSStreamEventEndEncountered: { // Cleanup the stream [stream close]; [stream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; - + break; } case NSStreamEventErrorOccurred: { diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxyFactory.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxyFactory.m index dc1a0b752..b2320c641 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxyFactory.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxyFactory.m @@ -5,9 +5,9 @@ #import "SDLDebugTool.h" #import "SDLIAPTransport.h" -#import "SDLTCPTransport.h" #import "SDLProtocol.h" #import "SDLProxy.h" +#import "SDLTCPTransport.h" @implementation SDLProxyFactory diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCRequestFactory.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCRequestFactory.m index 88ba28518..44f9848a8 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCRequestFactory.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCRequestFactory.m @@ -2,12 +2,10 @@ // #import "SDLRPCRequestFactory.h" -#import <UIKit/UIKit.h> -#import <CoreTelephony/CTTelephonyNetworkInfo.h> #import <CoreTelephony/CTCarrier.h> +#import <CoreTelephony/CTTelephonyNetworkInfo.h> +#import <UIKit/UIKit.h> -#import "SDLMenuParams.h" -#import "SDLTTSChunkFactory.h" #import "SDLAddCommand.h" #import "SDLAddSubMenu.h" #import "SDLAlert.h" @@ -29,6 +27,7 @@ #import "SDLImage.h" #import "SDLInteractionMode.h" #import "SDLListFiles.h" +#import "SDLMenuParams.h" #import "SDLPerformAudioPassThru.h" #import "SDLPerformInteraction.h" #import "SDLPutFile.h" @@ -51,6 +50,7 @@ #import "SDLSubscribeVehicleData.h" #import "SDLSyncMsgVersion.h" #import "SDLTTSChunk.h" +#import "SDLTTSChunkFactory.h" #import "SDLUnregisterAppInterface.h" #import "SDLUnsubscribeButton.h" #import "SDLUnsubscribeVehicleData.h" diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCStruct.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCStruct.m index a359fe7a3..dd96fff5d 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCStruct.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRPCStruct.m @@ -38,7 +38,7 @@ [ret setObject:[self serializeDictionary:(NSDictionary *)value version:version] forKey:key]; } else if ([value isKindOfClass:NSArray.class]) { NSArray *arrayVal = (NSArray *)value; - + if (arrayVal.count > 0 && ([[arrayVal objectAtIndex:0] isKindOfClass:SDLRPCStruct.class])) { NSMutableArray *serializedList = [NSMutableArray arrayWithCapacity:arrayVal.count]; for (SDLRPCStruct *serializeable in arrayVal) { diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLReadDIDResponse.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLReadDIDResponse.m index c9ec4ec4c..08c5477f6 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLReadDIDResponse.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLReadDIDResponse.m @@ -4,8 +4,8 @@ #import "SDLReadDIDResponse.h" -#import "SDLNames.h" #import "SDLDIDResult.h" +#import "SDLNames.h" @implementation SDLReadDIDResponse diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRegisterAppInterface.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRegisterAppInterface.m index b10917f94..318d5dfa7 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLRegisterAppInterface.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLRegisterAppInterface.m @@ -8,8 +8,8 @@ #import "SDLDeviceInfo.h" #import "SDLLanguage.h" #import "SDLNames.h" -#import "SDLTTSChunk.h" #import "SDLSyncMsgVersion.h" +#import "SDLTTSChunk.h" @implementation SDLRegisterAppInterface diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLResetGlobalProperties.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLResetGlobalProperties.m index 8e0a05f41..350f96de0 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLResetGlobalProperties.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLResetGlobalProperties.m @@ -4,8 +4,8 @@ #import "SDLResetGlobalProperties.h" -#import "SDLNames.h" #import "SDLGlobalProperty.h" +#import "SDLNames.h" @implementation SDLResetGlobalProperties diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLSiphonServer.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLSiphonServer.m index 8c2efeff0..dbb433424 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLSiphonServer.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLSiphonServer.m @@ -14,13 +14,13 @@ //#define DEBUG_SIPHON //Uncomment to have output to NSLog. #import "SDLSiphonServer.h" +#import "SDLDebugTool.h" #include <CFNetwork/CFNetwork.h> -#include <sys/socket.h> #include <netinet/in.h> -#include <sys/types.h> #include <string.h> +#include <sys/socket.h> +#include <sys/types.h> #include <unistd.h> -#import "SDLDebugTool.h" typedef enum { fromApp = 0x01, diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamDelegate.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamDelegate.m index c9f1f5671..6c2db6c34 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamDelegate.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamDelegate.m @@ -2,8 +2,8 @@ // SDLtreamDelegate.m // -#import "SDLDebugTool.h" #import "SDLStreamDelegate.h" +#import "SDLDebugTool.h" @interface SDLStreamDelegate () { dispatch_queue_t _input_stream_queue; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLTCPTransport.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLTCPTransport.m index 54eb63423..81fc9c555 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLTCPTransport.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLTCPTransport.m @@ -6,14 +6,14 @@ #import "SDLDebugTool.h" #import "SDLHexUtility.h" #import <errno.h> +#import <netdb.h> +#import <netinet/in.h> #import <signal.h> #import <stdio.h> -#import <unistd.h> -#import <sys/types.h> #import <sys/socket.h> +#import <sys/types.h> #import <sys/wait.h> -#import <netinet/in.h> -#import <netdb.h> +#import <unistd.h> // C function forward declarations. @@ -127,7 +127,7 @@ int call_socket(const char *hostname, const char *port) { gethostname(localhost, sizeof localhost); hostname = (const char *)&localhost; } - + //getaddrinfo setup if ((status = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo error: %s\n", gai_strerror(status)); diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.m index de6ecc595..7063c9c29 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.m @@ -5,8 +5,8 @@ #import "SDLUpdateTurnList.h" #import "SDLNames.h" -#import "SDLTurn.h" #import "SDLSoftButton.h" +#import "SDLTurn.h" @implementation SDLUpdateTurnList diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolMessage.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolMessage.m index f7c60a7a0..736dd0b13 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolMessage.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolMessage.m @@ -1,9 +1,9 @@ // SDLV1ProtocolMessage.m // +#import "SDLV1ProtocolMessage.h" #import "SDLJsonDecoder.h" #import "SDLProtocolHeader.h" -#import "SDLV1ProtocolMessage.h" @implementation SDLV1ProtocolMessage diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolMessage.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolMessage.m index 6d048b71d..683c10335 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolMessage.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolMessage.m @@ -1,12 +1,12 @@ // SDLSmartDeviceLinkV2ProtocolMessage.m // +#import "SDLV2ProtocolMessage.h" #import "SDLFunctionID.h" #import "SDLJsonDecoder.h" #import "SDLNames.h" #import "SDLProtocolHeader.h" #import "SDLRPCPayload.h" -#import "SDLV2ProtocolMessage.h" @implementation SDLV2ProtocolMessage diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLVehicleDataResult.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLVehicleDataResult.m index 3a0849f87..e395717eb 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLVehicleDataResult.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLVehicleDataResult.m @@ -4,8 +4,8 @@ #import "SDLVehicleDataResult.h" #import "SDLNames.h" -#import "SDLVehicleDataType.h" #import "SDLVehicleDataResultCode.h" +#import "SDLVehicleDataType.h" @implementation SDLVehicleDataResult diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink-iOS/SmartDeviceLink/SmartDeviceLink.h index 61a92e141..1bfbcb655 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SmartDeviceLink.h @@ -14,8 +14,8 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; /***** Proxy *****/ #import "SDLProxy.h" -#import "SDLProxyListener.h" #import "SDLProxyFactory.h" +#import "SDLProxyListener.h" #import "SDLStreamingMediaManager.h" #import "SDLTTSChunkFactory.h" @@ -27,15 +27,15 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; /***** Transport *****/ #import "SDLAbstractTransport.h" -#import "SDLIAPTransport.h" #import "SDLIAPSessionDelegate.h" +#import "SDLIAPTransport.h" #import "SDLTCPTransport.h" #import "SDLTransportDelegate.h" /***** Protocol *****/ -#import "SDLProtocolListener.h" #import "SDLAbstractProtocol.h" #import "SDLProtocol.h" +#import "SDLProtocolListener.h" // Header #import "SDLProtocolHeader.h" @@ -47,10 +47,10 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; // Superclasses #import "SDLEnum.h" #import "SDLRPCMessage.h" -#import "SDLRPCStruct.h" #import "SDLRPCNotification.h" #import "SDLRPCRequest.h" #import "SDLRPCResponse.h" +#import "SDLRPCStruct.h" // Factories #import "SDLRPCRequestFactory.h" @@ -148,8 +148,8 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLOnCommand.h" #import "SDLOnDriverDistraction.h" #import "SDLOnEncodedSyncPData.h" -#import "SDLOnHashChange.h" #import "SDLOnHMIStatus.h" +#import "SDLOnHashChange.h" #import "SDLOnKeyboardInput.h" #import "SDLOnLanguageChange.h" #import "SDLOnLockScreenStatus.h" @@ -168,16 +168,16 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLButtonCapabilities.h" #import "SDLChoice.h" #import "SDLClusterModeStatus.h" +#import "SDLDIDResult.h" #import "SDLDeviceInfo.h" #import "SDLDeviceStatus.h" -#import "SDLDIDResult.h" #import "SDLDisplayCapabilities.h" #import "SDLECallInfo.h" #import "SDLEmergencyEvent.h" #import "SDLGPSData.h" -#import "SDLHeadLampStatus.h" #import "SDLHMICapabilities.h" #import "SDLHMIPermissions.h" +#import "SDLHeadLampStatus.h" #import "SDLImage.h" #import "SDLImageField.h" #import "SDLImageResolution.h" @@ -193,16 +193,16 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLSoftButtonCapabilities.h" #import "SDLStartTime.h" #import "SDLSyncMsgVersion.h" +#import "SDLTTSChunk.h" #import "SDLTextField.h" #import "SDLTireStatus.h" #import "SDLTouchCoord.h" #import "SDLTouchEvent.h" #import "SDLTouchEventCapabilities.h" -#import "SDLTTSChunk.h" #import "SDLTurn.h" +#import "SDLVRHelpItem.h" #import "SDLVehicleDataResult.h" #import "SDLVehicleType.h" -#import "SDLVRHelpItem.h" // Enums #import "SDLAmbientLightStatus.h" @@ -242,16 +242,16 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLLockScreenStatus.h" #import "SDLMaintenanceModeStatus.h" #import "SDLMediaClockFormat.h" +#import "SDLPRNDL.h" #import "SDLPermissionStatus.h" #import "SDLPowerModeQualificationStatus.h" #import "SDLPowerModeStatus.h" #import "SDLPredefinedLayout.h" #import "SDLPrerecordedSpeech.h" #import "SDLPrimaryAudioSource.h" -#import "SDLPRNDL.h" +#import "SDLRPCMessageType.h" #import "SDLRequestType.h" #import "SDLResult.h" -#import "SDLRPCMessageType.h" #import "SDLSamplingRate.h" #import "SDLSoftButtonType.h" #import "SDLSpeechCapabilities.h" @@ -264,12 +264,12 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLTouchType.h" #import "SDLTriggerSource.h" #import "SDLUpdateMode.h" +#import "SDLVRCapabilities.h" #import "SDLVehicleDataActiveStatus.h" #import "SDLVehicleDataEventStatus.h" #import "SDLVehicleDataNotificationStatus.h" #import "SDLVehicleDataResultCode.h" #import "SDLVehicleDataStatus.h" #import "SDLVehicleDataType.h" -#import "SDLVRCapabilities.h" #import "SDLWarningLightStatus.h" #import "SDLWiperStatus.h" |