diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-07-24 16:28:32 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-07-24 16:28:32 -0400 |
commit | c733d3f75e4ab6e96a1c2667a2ea11b3b7bdf205 (patch) | |
tree | d5e038986db089c1b1ab2d55f73e4fbc42d00bce | |
parent | 45646e9671626b8431984779209dad16d75ccf47 (diff) | |
download | sdl_ios-c733d3f75e4ab6e96a1c2667a2ea11b3b7bdf205.tar.gz |
Create new files for new control frame payloads
* Shift around files in some groups
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 62 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.h | 24 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m | 87 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadEndService.h | 23 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadEndService.m | 77 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadNak.h (renamed from SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.h) | 4 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadNak.m (renamed from SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.m) | 10 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadRPCStartService.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadVideoStartService.h | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLControlFramePayloadVideoStartService.m | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDebugTool.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLProtocol.m | 24 |
13 files changed, 313 insertions, 30 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index ccdb270f2..d50dca608 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -286,8 +286,8 @@ 5D4631091F21261B0092EFDC /* SDLControlFramePayloadRPCStartServiceAck.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D4631071F21261A0092EFDC /* SDLControlFramePayloadRPCStartServiceAck.m */; }; 5D4631101F2135850092EFDC /* SDLControlFramePayloadConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D46310E1F2135850092EFDC /* SDLControlFramePayloadConstants.h */; }; 5D4631111F2135850092EFDC /* SDLControlFramePayloadConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D46310F1F2135850092EFDC /* SDLControlFramePayloadConstants.m */; }; - 5D4631141F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D4631121F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.h */; }; - 5D4631151F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D4631131F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.m */; }; + 5D4631141F2136B60092EFDC /* SDLControlFramePayloadNak.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D4631121F2136B60092EFDC /* SDLControlFramePayloadNak.h */; }; + 5D4631151F2136B60092EFDC /* SDLControlFramePayloadNak.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D4631131F2136B60092EFDC /* SDLControlFramePayloadNak.m */; }; 5D48329D1A8EA33D00252386 /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D48329C1A8EA33D00252386 /* Preferences.m */; }; 5D4832A11A92868E00252386 /* ProxyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D4832A01A92868E00252386 /* ProxyManager.m */; }; 5D4832A51A94F90D00252386 /* ConnectionTransitionContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D4832A41A94F90D00252386 /* ConnectionTransitionContext.m */; }; @@ -899,6 +899,12 @@ 5DB92D2F1AC59F0000C15BB0 /* SDLObjectWithPrioritySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB92D2E1AC59F0000C15BB0 /* SDLObjectWithPrioritySpec.m */; }; 5DB92D321AC9C8BA00C15BB0 /* SDLRPCStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DB92D301AC9C8BA00C15BB0 /* SDLRPCStruct.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5DB92D331AC9C8BA00C15BB0 /* SDLRPCStruct.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB92D311AC9C8BA00C15BB0 /* SDLRPCStruct.m */; }; + 5DB9964E1F26886C002D8795 /* SDLControlFramePayloadEndService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DB9964C1F26886C002D8795 /* SDLControlFramePayloadEndService.h */; }; + 5DB9964F1F26886C002D8795 /* SDLControlFramePayloadEndService.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB9964D1F26886C002D8795 /* SDLControlFramePayloadEndService.m */; }; + 5DB996571F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DB996551F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.h */; }; + 5DB996581F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB996561F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.m */; }; + 5DB9965C1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DB9965A1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.h */; }; + 5DB9965D1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DB9965B1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.m */; }; 5DBAE0AB1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */; }; 5DBAE0AD1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */; }; 5DC978261B7A38640012C2F1 /* SDLGlobalsSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */; }; @@ -1355,8 +1361,8 @@ 5D4631071F21261A0092EFDC /* SDLControlFramePayloadRPCStartServiceAck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadRPCStartServiceAck.m; sourceTree = "<group>"; }; 5D46310E1F2135850092EFDC /* SDLControlFramePayloadConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadConstants.h; sourceTree = "<group>"; }; 5D46310F1F2135850092EFDC /* SDLControlFramePayloadConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadConstants.m; sourceTree = "<group>"; }; - 5D4631121F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadRPCStartServiceNak.h; sourceTree = "<group>"; }; - 5D4631131F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadRPCStartServiceNak.m; sourceTree = "<group>"; }; + 5D4631121F2136B60092EFDC /* SDLControlFramePayloadNak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadNak.h; sourceTree = "<group>"; }; + 5D4631131F2136B60092EFDC /* SDLControlFramePayloadNak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadNak.m; sourceTree = "<group>"; }; 5D48329B1A8EA33D00252386 /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Preferences.h; path = SmartDeviceLink_Example/Classes/Preferences.h; sourceTree = SOURCE_ROOT; }; 5D48329C1A8EA33D00252386 /* Preferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Preferences.m; path = SmartDeviceLink_Example/Classes/Preferences.m; sourceTree = SOURCE_ROOT; }; 5D48329F1A92868E00252386 /* ProxyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProxyManager.h; path = SmartDeviceLink_Example/Classes/ProxyManager.h; sourceTree = SOURCE_ROOT; }; @@ -1978,6 +1984,12 @@ 5DB92D2E1AC59F0000C15BB0 /* SDLObjectWithPrioritySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLObjectWithPrioritySpec.m; path = "UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m"; sourceTree = "<group>"; }; 5DB92D301AC9C8BA00C15BB0 /* SDLRPCStruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLRPCStruct.h; sourceTree = "<group>"; }; 5DB92D311AC9C8BA00C15BB0 /* SDLRPCStruct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLRPCStruct.m; sourceTree = "<group>"; }; + 5DB9964C1F26886C002D8795 /* SDLControlFramePayloadEndService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadEndService.h; sourceTree = "<group>"; }; + 5DB9964D1F26886C002D8795 /* SDLControlFramePayloadEndService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadEndService.m; sourceTree = "<group>"; }; + 5DB996551F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadAudioStartServiceAck.h; sourceTree = "<group>"; }; + 5DB996561F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadAudioStartServiceAck.m; sourceTree = "<group>"; }; + 5DB9965A1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLControlFramePayloadVideoStartService.h; sourceTree = "<group>"; }; + 5DB9965B1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLControlFramePayloadVideoStartService.m; sourceTree = "<group>"; }; 5DBAE0AA1D3588AC00CE00BF /* SDLNotificationDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLNotificationDispatcherSpec.m; path = DevAPISpecs/SDLNotificationDispatcherSpec.m; sourceTree = "<group>"; }; 5DBAE0AC1D368D1A00CE00BF /* SDLResponseDispatcherSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLResponseDispatcherSpec.m; path = DevAPISpecs/SDLResponseDispatcherSpec.m; sourceTree = "<group>"; }; 5DC978251B7A38640012C2F1 /* SDLGlobalsSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLGlobalsSpec.m; path = UtilitiesSpecs/SDLGlobalsSpec.m; sourceTree = "<group>"; }; @@ -2618,17 +2630,19 @@ 5DA49CE41F1EA83300E65FC5 /* SDLControlFramePayloadRPCStartService.m */, 5D4631061F21261A0092EFDC /* SDLControlFramePayloadRPCStartServiceAck.h */, 5D4631071F21261A0092EFDC /* SDLControlFramePayloadRPCStartServiceAck.m */, - 5D4631121F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.h */, - 5D4631131F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.m */, ); name = "RPC Service"; sourceTree = "<group>"; }; - 5D4631161F223DEE0092EFDC /* End Service */ = { + 5D4631161F223DEE0092EFDC /* General */ = { isa = PBXGroup; children = ( + 5D4631121F2136B60092EFDC /* SDLControlFramePayloadNak.h */, + 5D4631131F2136B60092EFDC /* SDLControlFramePayloadNak.m */, + 5DB9964C1F26886C002D8795 /* SDLControlFramePayloadEndService.h */, + 5DB9964D1F26886C002D8795 /* SDLControlFramePayloadEndService.m */, ); - name = "End Service"; + name = General; sourceTree = "<group>"; }; 5D4832991A8EA27200252386 /* Storyboards */ = { @@ -3741,8 +3755,10 @@ children = ( 5D46310E1F2135850092EFDC /* SDLControlFramePayloadConstants.h */, 5D46310F1F2135850092EFDC /* SDLControlFramePayloadConstants.m */, + 5DB996541F268E9D002D8795 /* Audio Service */, + 5D4631161F223DEE0092EFDC /* General */, 5D46310D1F2133940092EFDC /* RPC Service */, - 5D4631161F223DEE0092EFDC /* End Service */, + 5DB996591F268F78002D8795 /* Video Service */, 5D4631051F2125F70092EFDC /* @protocols */, ); name = "Control Frame Payloads"; @@ -3828,6 +3844,24 @@ name = "Prioritized Objects"; sourceTree = "<group>"; }; + 5DB996541F268E9D002D8795 /* Audio Service */ = { + isa = PBXGroup; + children = ( + 5DB996551F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.h */, + 5DB996561F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.m */, + ); + name = "Audio Service"; + sourceTree = "<group>"; + }; + 5DB996591F268F78002D8795 /* Video Service */ = { + isa = PBXGroup; + children = ( + 5DB9965A1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.h */, + 5DB9965B1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.m */, + ); + name = "Video Service"; + sourceTree = "<group>"; + }; 5DBAE0A51D355EE700CE00BF /* Lock Screen */ = { isa = PBXGroup; children = ( @@ -4095,6 +4129,7 @@ 5D61FDE71A84238C00846EE7 /* SDLUnsubscribeButton.h in Headers */, 5D61FC691A84238C00846EE7 /* SDLConsoleController.h in Headers */, 5D61FCAB1A84238C00846EE7 /* SDLFuelCutoffStatus.h in Headers */, + 5DB9965C1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.h in Headers */, 5D1665C81CF8CA3D00CC4CA1 /* SDLPermissionFilter.h in Headers */, E9C32B911AB20BA200F283AF /* SDLIAPSession.h in Headers */, 5D61FCD71A84238C00846EE7 /* SDLInteractionMode.h in Headers */, @@ -4108,6 +4143,7 @@ 5D61FE111A84238C00846EE7 /* SDLWarningLightStatus.h in Headers */, 5D61FC7A1A84238C00846EE7 /* SDLDeleteInteractionChoiceSet.h in Headers */, 5D61FC3B1A84238C00846EE7 /* SDLAlertManeuverResponse.h in Headers */, + 5DB9964E1F26886C002D8795 /* SDLControlFramePayloadEndService.h in Headers */, 5D61FC6F1A84238C00846EE7 /* SDLDebugTool.h in Headers */, 5D61FDB71A84238C00846EE7 /* SDLSyncPData.h in Headers */, 5D61FD011A84238C00846EE7 /* SDLOnAudioPassThru.h in Headers */, @@ -4181,6 +4217,7 @@ E9C32B861AB20B4300F283AF /* NSThread+ThreadIndex.h in Headers */, 5D61FC741A84238C00846EE7 /* SDLDeleteCommandResponse.h in Headers */, 5D61FDF11A84238C00846EE7 /* SDLUpdateTurnList.h in Headers */, + 5DB996571F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.h in Headers */, 5D61FD671A84238C00846EE7 /* SDLResult.h in Headers */, 5D61FD351A84238C00846EE7 /* SDLPowerModeStatus.h in Headers */, 5D61FD971A84238C00846EE7 /* SDLSingleTireStatus.h in Headers */, @@ -4376,7 +4413,7 @@ 5D82041E1BCD8E6100D0A41B /* SDLConfiguration.h in Headers */, 5D61FD4A1A84238C00846EE7 /* SDLProtocolMessageAssembler.h in Headers */, 5D61FD4C1A84238C00846EE7 /* SDLProtocolMessageDisassembler.h in Headers */, - 5D4631141F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.h in Headers */, + 5D4631141F2136B60092EFDC /* SDLControlFramePayloadNak.h in Headers */, 5D61FD4E1A84238C00846EE7 /* SDLProtocolReceivedMessageRouter.h in Headers */, 97E26DEC1E807AD70074A3C7 /* SDLMutableDataQueue.h in Headers */, 5D61FDF71A84238C00846EE7 /* SDLV1ProtocolMessage.h in Headers */, @@ -4645,6 +4682,7 @@ 5D61FCC81A84238C00846EE7 /* SDLIAPTransport.m in Sources */, 5D61FE101A84238C00846EE7 /* SDLVrHelpItem.m in Sources */, 5D61FCC01A84238C00846EE7 /* SDLHexUtility.m in Sources */, + 5DB9964F1F26886C002D8795 /* SDLControlFramePayloadEndService.m in Sources */, 5D61FD821A84238C00846EE7 /* SDLSetAppIconResponse.m in Sources */, 5D61FDF81A84238C00846EE7 /* SDLV1ProtocolMessage.m in Sources */, 5D61FDC81A84238C00846EE7 /* SDLTextAlignment.m in Sources */, @@ -4680,6 +4718,7 @@ 5D61FDB21A84238C00846EE7 /* SDLSubscribeVehicleData.m in Sources */, 5D61FC991A84238C00846EE7 /* SDLECallInfo.m in Sources */, 5D61FD601A84238C00846EE7 /* SDLRegisterAppInterfaceResponse.m in Sources */, + 5DB996581F268ECB002D8795 /* SDLControlFramePayloadAudioStartServiceAck.m in Sources */, DAC572621D10C5020004288B /* SDLPinchGesture.m in Sources */, 5D61FCF51A84238C00846EE7 /* SDLMaintenanceModeStatus.m in Sources */, 5D61FCD81A84238C00846EE7 /* SDLInteractionMode.m in Sources */, @@ -4708,12 +4747,13 @@ 5D3E48801D6F88A30000BFEF /* SDLRPCNotificationNotification.m in Sources */, DAC572581D1067270004288B /* SDLTouchManager.m in Sources */, 5D61FC641A84238C00846EE7 /* SDLClusterModeStatus.m in Sources */, + 5DB9965D1F268F97002D8795 /* SDLControlFramePayloadVideoStartService.m in Sources */, 5D61FCF91A84238C00846EE7 /* SDLMenuParams.m in Sources */, 5D61FD7C1A84238C00846EE7 /* SDLScrollableMessage.m in Sources */, 5D4D67B11D2FE2F900468B4A /* SDLResponseDispatcher.m in Sources */, 5D61FD801A84238C00846EE7 /* SDLSetAppIcon.m in Sources */, 5D61FD3C1A84238C00846EE7 /* SDLPresetBankCapabilities.m in Sources */, - 5D4631151F2136B60092EFDC /* SDLControlFramePayloadRPCStartServiceNak.m in Sources */, + 5D4631151F2136B60092EFDC /* SDLControlFramePayloadNak.m in Sources */, 5D61FDB81A84238C00846EE7 /* SDLSyncPData.m in Sources */, 5DA49CD61F1E890500E65FC5 /* bson_object.c in Sources */, 5D61FD221A84238C00846EE7 /* SDLOnVehicleData.m in Sources */, diff --git a/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.h b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.h new file mode 100644 index 000000000..4dbfe041b --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.h @@ -0,0 +1,24 @@ +// +// SDLControlFramePayloadAudioStartServiceAck.h +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import "SDLControlFramePayloadType.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SDLControlFramePayloadAudioStartServiceAck : NSObject + +@property (assign, nonatomic, readonly) int32_t hashId; +@property (assign, nonatomic, readonly) int64_t mtu; + +- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m new file mode 100644 index 000000000..e4e81abee --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadAudioStartServiceAck.m @@ -0,0 +1,87 @@ +// +// SDLControlFramePayloadAudioStartServiceAck.m +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLControlFramePayloadAudioStartServiceAck.h" + +#import "bson_object.h" +#import "SDLControlFramePayloadConstants.h" + + +NS_ASSUME_NONNULL_BEGIN + +@interface SDLControlFramePayloadAudioStartServiceAck () + +@property (assign, nonatomic, readwrite) int32_t hashId; +@property (assign, nonatomic, readwrite) int64_t mtu; +@property (copy, nonatomic, readwrite, nullable) NSString *protocolVersion; + +@end + +@implementation SDLControlFramePayloadAudioStartServiceAck + +- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu { + self = [super init]; + if (!self) return nil; + + _hashId = hashId; + _mtu = mtu; + + return self; +} + +- (instancetype)initWithData:(nullable NSData *)data { + self = [super init]; + if (!self) return nil; + + _hashId = SDLControlFrameInt32NotFound; + _mtu = SDLControlFrameInt64NotFound; + + if (data != nil) { + [self sdl_parse:data]; + } + + return self; +} + +- (nullable NSData *)data { + if (self.hashId == SDLControlFrameInt32NotFound + && self.mtu == SDLControlFrameInt64NotFound) { + return nil; + } + + BsonObject payloadObject; + bson_object_initialize_default(&payloadObject); + + if (self.hashId != SDLControlFrameInt32NotFound) { + bson_object_put_int32(&payloadObject, SDLControlFrameHashIdKey, self.hashId); + } + + if (self.mtu != SDLControlFrameInt64NotFound) { + bson_object_put_int64(&payloadObject, SDLControlFrameMTUKey, self.mtu); + } + + BytePtr bsonData = bson_object_to_bytes(&payloadObject); + NSUInteger length = bson_object_size(&payloadObject); + + bson_object_deinitialize(&payloadObject); + + return [[NSData alloc] initWithBytes:bsonData length:length]; +} + +- (void)sdl_parse:(NSData *)data { + BsonObject payloadObject = bson_object_from_bytes((BytePtr)data.bytes); + + self.hashId = bson_object_get_int32(&payloadObject, SDLControlFrameHashIdKey); + self.mtu = bson_object_get_int64(&payloadObject, SDLControlFrameMTUKey); + + bson_object_deinitialize(&payloadObject); +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLControlFramePayloadEndService.h b/SmartDeviceLink/SDLControlFramePayloadEndService.h new file mode 100644 index 000000000..5a06a4c21 --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadEndService.h @@ -0,0 +1,23 @@ +// +// SDLControlFramePayloadEndService.h +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import "SDLControlFramePayloadType.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SDLControlFramePayloadEndService : NSObject <SDLControlFramePayloadType> + +@property (assign, nonatomic, readonly) int32_t hashId; + +- (instancetype)initWithHashId:(int32_t)hashId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLControlFramePayloadEndService.m b/SmartDeviceLink/SDLControlFramePayloadEndService.m new file mode 100644 index 000000000..52825d982 --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadEndService.m @@ -0,0 +1,77 @@ +// +// SDLControlFramePayloadEndService.m +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLControlFramePayloadEndService.h" + +#import "bson_object.h" +#import "SDLControlFramePayloadConstants.h" + + +NS_ASSUME_NONNULL_BEGIN + +@interface SDLControlFramePayloadEndService () + +@property (assign, nonatomic, readwrite) int32_t hashId; + +@end + +@implementation SDLControlFramePayloadEndService + +- (instancetype)initWithHashId:(int32_t)hashId { + self = [super init]; + if (!self) return nil; + + _hashId = hashId; + + return self; +} + +- (instancetype)initWithData:(nullable NSData *)data { + self = [super init]; + if (!self) return nil; + + _hashId = SDLControlFrameInt32NotFound; + + if (data != nil) { + [self sdl_parse:data]; + } + + return self; +} + +- (nullable NSData *)data { + if (self.hashId == SDLControlFrameInt32NotFound) { + return nil; + } + + BsonObject payloadObject; + bson_object_initialize_default(&payloadObject); + + if (self.hashId != SDLControlFrameInt32NotFound) { + bson_object_put_int32(&payloadObject, SDLControlFrameHashIdKey, self.hashId); + } + + BytePtr bsonData = bson_object_to_bytes(&payloadObject); + NSUInteger length = bson_object_size(&payloadObject); + + bson_object_deinitialize(&payloadObject); + + return [[NSData alloc] initWithBytes:bsonData length:length]; +} + +- (void)sdl_parse:(NSData *)data { + BsonObject payloadObject = bson_object_from_bytes((BytePtr)data.bytes); + + self.hashId = bson_object_get_int32(&payloadObject, SDLControlFrameHashIdKey); + + bson_object_deinitialize(&payloadObject); +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.h b/SmartDeviceLink/SDLControlFramePayloadNak.h index 2b95c1446..32879357b 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.h +++ b/SmartDeviceLink/SDLControlFramePayloadNak.h @@ -1,5 +1,5 @@ // -// SDLControlFramePayloadRPCStartServiceNak.h +// SDLControlFramePayloadNak.h // SmartDeviceLink-iOS // // Created by Joel Fischer on 7/20/17. @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface SDLControlFramePayloadRPCStartServiceNak : NSObject <SDLControlFramePayloadType> +@interface SDLControlFramePayloadNak : NSObject <SDLControlFramePayloadType> @property (copy, nonatomic, readonly, nullable) NSArray<NSString *> *rejectedParams; diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.m b/SmartDeviceLink/SDLControlFramePayloadNak.m index 08bfacf72..170be47d4 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceNak.m +++ b/SmartDeviceLink/SDLControlFramePayloadNak.m @@ -1,12 +1,12 @@ // -// SDLControlFramePayloadRPCStartServiceNak.m +// SDLControlFramePayloadNak.m // SmartDeviceLink-iOS // // Created by Joel Fischer on 7/20/17. // Copyright © 2017 smartdevicelink. All rights reserved. // -#import "SDLControlFramePayloadRPCStartServiceNak.h" +#import "SDLControlFramePayloadNak.h" #import "bson_object.h" #import "SDLControlFramePayloadConstants.h" @@ -14,13 +14,13 @@ NS_ASSUME_NONNULL_BEGIN -@interface SDLControlFramePayloadRPCStartServiceNak () +@interface SDLControlFramePayloadNak () @property (copy, nonatomic, readwrite, nullable) NSArray<NSString *> *rejectedParams; @end -@implementation SDLControlFramePayloadRPCStartServiceNak +@implementation SDLControlFramePayloadNak - (instancetype)initWithRejectedParams:(nullable NSArray<NSString *> *)rejectedParams { self = [super init]; @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN self = [super init]; if (!self) return nil; - if (data) { + if (data != nil) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m index e2990d973..f757730f6 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartService.m @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN self = [super init]; if (!self) return nil; - if (data) { + if (data != nil) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m index a18de025e..fe7d1a026 100644 --- a/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m +++ b/SmartDeviceLink/SDLControlFramePayloadRPCStartServiceAck.m @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN _hashId = SDLControlFrameInt32NotFound; _mtu = SDLControlFrameInt64NotFound; - if (data) { + if (data != nil) { [self sdl_parse:data]; } diff --git a/SmartDeviceLink/SDLControlFramePayloadVideoStartService.h b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.h new file mode 100644 index 000000000..5c37828b5 --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.h @@ -0,0 +1,13 @@ +// +// SDLControlFramePayloadVideoStartService.h +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface SDLControlFramePayloadVideoStartService : NSObject + +@end diff --git a/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m new file mode 100644 index 000000000..a9e04986d --- /dev/null +++ b/SmartDeviceLink/SDLControlFramePayloadVideoStartService.m @@ -0,0 +1,13 @@ +// +// SDLControlFramePayloadVideoStartService.m +// SmartDeviceLink-iOS +// +// Created by Joel Fischer on 7/24/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLControlFramePayloadVideoStartService.h" + +@implementation SDLControlFramePayloadVideoStartService + +@end diff --git a/SmartDeviceLink/SDLDebugTool.m b/SmartDeviceLink/SDLDebugTool.m index 1186dc340..d3327ef77 100644 --- a/SmartDeviceLink/SDLDebugTool.m +++ b/SmartDeviceLink/SDLDebugTool.m @@ -131,7 +131,7 @@ [outputString appendString:info]; } - if (data) { + if (data != nil) { @autoreleasepool { NSString *dataString = [SDLHexUtility getHexString:data]; if (dataString) { diff --git a/SmartDeviceLink/SDLProtocol.m b/SmartDeviceLink/SDLProtocol.m index 1682ab6bd..7d75c6b9d 100644 --- a/SmartDeviceLink/SDLProtocol.m +++ b/SmartDeviceLink/SDLProtocol.m @@ -7,9 +7,9 @@ #import "SDLAbstractTransport.h" #import "SDLControlFramePayloadConstants.h" +#import "SDLControlFramePayloadNak.h" #import "SDLControlFramePayloadRPCStartService.h" #import "SDLControlFramePayloadRPCStartServiceAck.h" -#import "SDLControlFramePayloadRPCStartServiceNak.h" #import "SDLDebugTool.h" #import "SDLGlobals.h" #import "SDLPrioritizedObjectCollection.h" @@ -465,14 +465,7 @@ typedef NSNumber SDLServiceTypeBox; } - (void)handleProtocolStartServiceNAKMessage:(SDLProtocolMessage *)startServiceNAK { - if (startServiceNAK.header.version >= 5) { - SDLControlFramePayloadRPCStartServiceNak *startServiceNakPayload = [[SDLControlFramePayloadRPCStartServiceNak alloc] initWithData:startServiceNAK.data]; - NSArray<NSString *> *rejectedParams = startServiceNakPayload.rejectedParams; - if (rejectedParams.count > 0) { - NSString *log = [NSString stringWithFormat:@"Start Service NAK'd, service type: %@, rejectedParams: %@", @(startServiceNAK.header.serviceType), rejectedParams]; - [SDLDebugTool logInfo:log]; - } - } + [self sdl_logControlNAKPayload:startServiceNAK]; for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) { if ([listener respondsToSelector:@selector(handleProtocolStartServiceNAKMessage:)]) { @@ -507,6 +500,8 @@ typedef NSNumber SDLServiceTypeBox; } - (void)handleProtocolEndServiceNAKMessage:(SDLProtocolMessage *)endServiceNAK { + [self sdl_logControlNAKPayload:endServiceNAK]; + for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) { if ([listener respondsToSelector:@selector(handleProtocolEndServiceNAKMessage:)]) { [listener handleProtocolEndServiceNAKMessage:endServiceNAK]; @@ -584,6 +579,17 @@ typedef NSNumber SDLServiceTypeBox; } } +- (void)sdl_logControlNAKPayload:(SDLProtocolMessage *)nakMessage { + if (nakMessage.header.version >= 5) { + SDLControlFramePayloadNak *endServiceNakPayload = [[SDLControlFramePayloadNak alloc] initWithData:nakMessage.data]; + NSArray<NSString *> *rejectedParams = endServiceNakPayload.rejectedParams; + if (rejectedParams.count > 0) { + NSString *log = [NSString stringWithFormat:@"Start Service NAK'd, service type: %@, rejectedParams: %@", @(nakMessage.header.serviceType), rejectedParams]; + [SDLDebugTool logInfo:log]; + } + } +} + #pragma mark - TLS Handshake // TODO: These should be split out to a separate class to be tested properly |