summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-02-26 08:47:32 -0800
committerGitHub <noreply@github.com>2021-02-26 08:47:32 -0800
commit648e0062dbe2eab265a0c08c235d8a60d87634c7 (patch)
tree51af5d474588833d0f50df151a6982e253c5674e
parentc9db35d11bc18c8f7a341f0f4231a381f9e3be2e (diff)
parent90f41bc2be9af323074b037535edfa19410470e7 (diff)
downloadsdl_ios-648e0062dbe2eab265a0c08c235d8a60d87634c7.tar.gz
Merge pull request #1919 from smartdevicelink/feature/issue-1876-sdl-0293-enable-oem-exclusive-app-support
Implement SDL-0293 Enable OEM Exclusive App Support
-rw-r--r--Example Apps/Example ObjC/ProxyManager.m8
-rw-r--r--Example Apps/Example Swift/ProxyManager.swift12
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/project.pbxproj48
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink-Example-ObjC.xcscheme2
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink.xcscheme2
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLinkSwift.xcscheme2
-rw-r--r--SmartDeviceLink/private/SDLConnectionManagerType.h5
-rw-r--r--SmartDeviceLink/private/SDLControlFramePayloadConstants.h22
-rw-r--r--SmartDeviceLink/private/SDLControlFramePayloadConstants.m22
-rw-r--r--SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.h46
-rw-r--r--SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.m74
-rw-r--r--SmartDeviceLink/private/SDLEncryptionLifecycleManager.m20
-rw-r--r--SmartDeviceLink/private/SDLGlobals.m2
-rw-r--r--SmartDeviceLink/private/SDLLifecycleManager.h2
-rw-r--r--SmartDeviceLink/private/SDLLifecycleManager.m41
-rw-r--r--SmartDeviceLink/private/SDLProtocol.h4
-rw-r--r--SmartDeviceLink/private/SDLProtocol.m17
-rw-r--r--SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m22
-rw-r--r--SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m13
-rw-r--r--SmartDeviceLink/public/SDLManagerDelegate.h8
-rw-r--r--SmartDeviceLink/public/SDLRegisterAppInterfaceResponse.h16
-rw-r--r--SmartDeviceLink/public/SDLSystemInfo.h43
-rw-r--r--SmartDeviceLink/public/SDLSystemInfo.m49
-rw-r--r--SmartDeviceLink/public/SDLVehicleType.h11
-rw-r--r--SmartDeviceLink/public/SDLVehicleType.m12
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m263
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m25
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m20
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLSystemInfoSpec.m83
-rw-r--r--SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLControlFramePayloadConstantsSpec.m27
-rw-r--r--SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m43
-rw-r--r--SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m173
-rw-r--r--SmartDeviceLinkTests/ProxySpecs/SDLSecondaryTransportManagerSpec.m12
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m20
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m58
-rw-r--r--SmartDeviceLinkTests/SDLEncryptionLifecycleManagerSpec.m206
-rw-r--r--SmartDeviceLinkTests/TestUtilities/TestConnectionManager.h2
-rw-r--r--SmartDeviceLinkTests/TestUtilities/TestConnectionManager.m1
38 files changed, 913 insertions, 523 deletions
diff --git a/Example Apps/Example ObjC/ProxyManager.m b/Example Apps/Example ObjC/ProxyManager.m
index 0d13454d7..9cb17a9e0 100644
--- a/Example Apps/Example ObjC/ProxyManager.m
+++ b/Example Apps/Example ObjC/ProxyManager.m
@@ -229,8 +229,7 @@ NS_ASSUME_NONNULL_BEGIN
}
#pragma mark - SDLManagerDelegate
-
-/// Called when the connection beween this app and the module has closed.
+/// Called when the connection between this app and the module has closed.
- (void)managerDidDisconnect {
if (self.state != ProxyStateStopped) {
[self sdlex_updateProxyState:ProxyStateSearchingForConnection];
@@ -318,6 +317,11 @@ NS_ASSUME_NONNULL_BEGIN
return update;
}
+- (BOOL)didReceiveSystemInfo:(SDLSystemInfo *)systemInfo {
+ SDLLogD(@"Example app did receive system info: %@", systemInfo);
+ return YES;
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift
index 8a53e7c76..6c04e57fa 100644
--- a/Example Apps/Example Swift/ProxyManager.swift
+++ b/Example Apps/Example Swift/ProxyManager.swift
@@ -146,8 +146,8 @@ private extension ProxyManager {
// MARK: - SDLManagerDelegate
extension ProxyManager: SDLManagerDelegate {
- /// Called when the connection beween this app and the module has closed.
- func managerDidDisconnect() {
+ /// Called when the connection between this app and the module has closed.
+ func managerDidDisconnect() {
if delegate?.proxyState != .some(.stopped) {
delegate?.didChangeProxyState(ProxyState.searching)
}
@@ -234,6 +234,14 @@ extension ProxyManager: SDLManagerDelegate {
return update
}
+
+ /// Called when connected module information becomes available
+ /// - Parameter systemInfo: The connected module's information
+ /// - Returns: True to continue connecting, false to disconnect immediately
+ func didReceive(systemInfo: SDLSystemInfo) -> Bool {
+ SDLLog.d("Example app got system info: \(systemInfo)")
+ return true
+ }
}
// MARK: - SDL UI
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
index 49658d0d3..57fe1482a 100644
--- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
+++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
@@ -284,6 +284,7 @@
2BF2F85220ED068200A26EF2 /* SDLAudioStreamingIndicatorSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BF2F85120ED068200A26EF2 /* SDLAudioStreamingIndicatorSpec.m */; };
4A1B036F24CF484E008C6B13 /* SDLDriverDistractionCapabilitySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1B036E24CF484E008C6B13 /* SDLDriverDistractionCapabilitySpec.m */; };
4A1FA09B25114833006B7851 /* SDLErrorConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A1FA09A25114833006B7851 /* SDLErrorConstants.m */; };
+ 4A39C6FA25E84C87005C8943 /* SDLKeyboardCapabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D9DF25D2571000CDFD21 /* SDLKeyboardCapabilities.m */; };
4A40254124FFDA660080E159 /* SDLTextAndGraphicState.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A40253D24FFDA660080E159 /* SDLTextAndGraphicState.m */; };
4A40254224FFDA660080E159 /* SDLTextAndGraphicUpdateOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A40253E24FFDA660080E159 /* SDLTextAndGraphicUpdateOperation.h */; };
4A40254324FFDA660080E159 /* SDLTextAndGraphicUpdateOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A40253F24FFDA660080E159 /* SDLTextAndGraphicUpdateOperation.m */; };
@@ -511,6 +512,9 @@
4A8BD3CD24F999BE000945E3 /* TestSubscribeButtonObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A8BD3CC24F999BE000945E3 /* TestSubscribeButtonObserver.m */; };
4A8BD3D024FE7CF1000945E3 /* SDLPermissionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A8BD3CE24FE7CF1000945E3 /* SDLPermissionManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
4A8BD3D124FE7CF1000945E3 /* SDLPermissionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A8BD3CF24FE7CF1000945E3 /* SDLPermissionManager.m */; };
+ 4AAB6A1225E57BEA0017A5A7 /* SDLSystemInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AAB6A1025E57BEA0017A5A7 /* SDLSystemInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4AAB6A1325E57BEA0017A5A7 /* SDLSystemInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAB6A1125E57BEA0017A5A7 /* SDLSystemInfo.m */; };
+ 4AAB6A2325E69D010017A5A7 /* SDLSystemInfoSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AAB6A2225E69D010017A5A7 /* SDLSystemInfoSpec.m */; };
4ABB24BA24F592620061BF55 /* NSMutableArray+Safe.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ABB24B224F592620061BF55 /* NSMutableArray+Safe.h */; };
4ABB24BB24F592620061BF55 /* NSMutableArray+Safe.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ABB24B324F592620061BF55 /* NSMutableArray+Safe.m */; };
4ABB24BC24F592620061BF55 /* NSBundle+SDLBundle.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ABB24B424F592620061BF55 /* NSBundle+SDLBundle.m */; };
@@ -1687,7 +1691,6 @@
B38D8E7E24A118BD00B977D0 /* SDLGearStatusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E7D24A118BD00B977D0 /* SDLGearStatusSpec.m */; };
B38D8E8024A1E3D000B977D0 /* SDLTransmissionTypeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */; };
B38D8E8224A1F53500B977D0 /* SDLCapacityUnitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */; };
- B3A9D9E125D2571000CDFD21 /* SDLKeyboardCapabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D9DF25D2571000CDFD21 /* SDLKeyboardCapabilities.m */; };
B3A9D9E225D2571000CDFD21 /* SDLKeyboardCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9E025D2571000CDFD21 /* SDLKeyboardCapabilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
B3A9D9E725D2578F00CDFD21 /* SDLKeyboardLayoutCapability.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D9E525D2578F00CDFD21 /* SDLKeyboardLayoutCapability.m */; };
B3A9D9E825D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9E625D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2329,6 +2332,9 @@
4A8BD3CC24F999BE000945E3 /* TestSubscribeButtonObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSubscribeButtonObserver.m; sourceTree = "<group>"; };
4A8BD3CE24FE7CF1000945E3 /* SDLPermissionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLPermissionManager.h; path = public/SDLPermissionManager.h; sourceTree = "<group>"; };
4A8BD3CF24FE7CF1000945E3 /* SDLPermissionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLPermissionManager.m; path = public/SDLPermissionManager.m; sourceTree = "<group>"; };
+ 4AAB6A1025E57BEA0017A5A7 /* SDLSystemInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SDLSystemInfo.h; path = public/SDLSystemInfo.h; sourceTree = "<group>"; };
+ 4AAB6A1125E57BEA0017A5A7 /* SDLSystemInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLSystemInfo.m; path = public/SDLSystemInfo.m; sourceTree = "<group>"; };
+ 4AAB6A2225E69D010017A5A7 /* SDLSystemInfoSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLSystemInfoSpec.m; path = DevAPISpecs/SDLSystemInfoSpec.m; sourceTree = "<group>"; };
4ABB24B224F592620061BF55 /* NSMutableArray+Safe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+Safe.h"; path = "private/NSMutableArray+Safe.h"; sourceTree = "<group>"; };
4ABB24B324F592620061BF55 /* NSMutableArray+Safe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+Safe.m"; path = "private/NSMutableArray+Safe.m"; sourceTree = "<group>"; };
4ABB24B424F592620061BF55 /* NSBundle+SDLBundle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBundle+SDLBundle.m"; path = "private/NSBundle+SDLBundle.m"; sourceTree = "<group>"; };
@@ -4046,7 +4052,6 @@
B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */,
885468372225CBA400994D8D /* SDLCloudAppPropertiesSpec.m */,
162E82951A9BDE8A00906325 /* SDLClusterModeStatusSpec.m */,
- B3992641258FAADF0048F09B /* SDLConfigurableKeyboardsSpec.m */,
DA9F7EB31DCC086400ACAE48 /* SDLDateTimeSpec.m */,
162E82961A9BDE8A00906325 /* SDLDeviceInfoSpec.m */,
162E82971A9BDE8A00906325 /* SDLDeviceStatusSpec.m */,
@@ -4338,6 +4343,15 @@
name = "Status Manager";
sourceTree = "<group>";
};
+ 4AAB6A0F25E57B2D0017A5A7 /* Utilities */ = {
+ isa = PBXGroup;
+ children = (
+ 4AAB6A1025E57BEA0017A5A7 /* SDLSystemInfo.h */,
+ 4AAB6A1125E57BEA0017A5A7 /* SDLSystemInfo.m */,
+ );
+ name = Utilities;
+ sourceTree = "<group>";
+ };
4AD1F16A2559952D00637FE1 /* Voice Command */ = {
isa = PBXGroup;
children = (
@@ -4453,16 +4467,17 @@
5D1654541D3E753100554D93 /* Lifecycle */ = {
isa = PBXGroup;
children = (
- 5D1654551D3E754F00554D93 /* SDLLifecycleManagerSpec.m */,
888F86FF221DF4880052FE4C /* SDLAsynchronousRPCOperationSpec.m */,
5D60DF23202B7A80001EDA01 /* SDLAsynchronousRPCRequestOperationSpec.m */,
- 5D60DF25202B7A97001EDA01 /* SDLSequentialRPCRequestOperationSpec.m */,
88A1CF1D21669AC7001ACC75 /* SDLLifecycleConfigurationUpdateSpec.m */,
+ 5D1654551D3E754F00554D93 /* SDLLifecycleManagerSpec.m */,
+ 4A457DD424A3C16E00386CBA /* SDLLifecycleMobileHMIStateHandlerSpec.m */,
4A457DC224A2933E00386CBA /* SDLLifecycleRPCAdapterSpec.m */,
4A457DD224A3886700386CBA /* SDLLifecycleSyncPDataHandlerSpec.m */,
- 4A457DD424A3C16E00386CBA /* SDLLifecycleMobileHMIStateHandlerSpec.m */,
4A457DD624A3CCED00386CBA /* SDLLifecycleSystemRequestHandlerSpec.m */,
4A457DD824A5137100386CBA /* SDLLifecycleProtocolHandlerSpec.m */,
+ 5D60DF25202B7A97001EDA01 /* SDLSequentialRPCRequestOperationSpec.m */,
+ 4AAB6A2225E69D010017A5A7 /* SDLSystemInfoSpec.m */,
);
name = Lifecycle;
sourceTree = "<group>";
@@ -4475,6 +4490,7 @@
4A3BA4E324900962003E56B8 /* Custom RPC Handlers */,
4A3BA4E9249147E6003E56B8 /* Protocol Delegate Handler */,
5D07C0342044AD1900D1ECDC /* Request Operations */,
+ 4AAB6A0F25E57B2D0017A5A7 /* Utilities */,
4ABB253924F7E46A0061BF55 /* SDLLifecycleManager.h */,
4ABB253824F7E46A0061BF55 /* SDLLifecycleManager.m */,
);
@@ -5095,8 +5111,6 @@
4ABB2B2124F84EF00061BF55 /* SDLCloudAppProperties.m */,
4ABB2B3224F84EF30061BF55 /* SDLClusterModeStatus.h */,
4ABB2B3024F84EF30061BF55 /* SDLClusterModeStatus.m */,
- B3992632258C276B0048F09B /* SDLConfigurableKeyboards.h */,
- B3992631258C276A0048F09B /* SDLConfigurableKeyboards.m */,
4ABB2B2D24F84EF20061BF55 /* SDLDateTime.h */,
4ABB2B2324F84EF00061BF55 /* SDLDateTime.m */,
4ABB2B1F24F84EF00061BF55 /* SDLDeviceInfo.h */,
@@ -5163,8 +5177,6 @@
4ABB2B9724F850AD0061BF55 /* SDLLightControlData.m */,
4ABB2B9424F850AC0061BF55 /* SDLLightState.h */,
4ABB2B9A24F850AD0061BF55 /* SDLLightState.m */,
- B3992622258C1E480048F09B /* SDLKeyboardCapabilities.h */,
- B3992621258C1E480048F09B /* SDLKeyboardCapabilities.m */,
4A8BD22724F93132000945E3 /* SDLKeyboardProperties.h */,
4A8BD23A24F93135000945E3 /* SDLKeyboardProperties.m */,
4A8BD22824F93132000945E3 /* SDLLocationCoordinate.h */,
@@ -5396,8 +5408,6 @@
4ABB278224F7FF090061BF55 /* SDLInteractionMode.m */,
4ABB278624F7FF0A0061BF55 /* SDLKeyboardEvent.h */,
4ABB277E24F7FF090061BF55 /* SDLKeyboardEvent.m */,
- B3992627258C24120048F09B /* SDLKeyboardInputMask.h */,
- B3992628258C24130048F09B /* SDLKeyboardInputMask.m */,
4ABB278B24F7FF0B0061BF55 /* SDLKeyboardLayout.h */,
4ABB277F24F7FF090061BF55 /* SDLKeyboardLayout.m */,
4ABB278824F7FF0A0061BF55 /* SDLKeypressMode.h */,
@@ -7031,7 +7041,6 @@
B3838A20257C5BB000420C11 /* SDLRoofStatus.h in Headers */,
4ABB271824F7FC4E0061BF55 /* SDLCompassDirection.h in Headers */,
4ABB2B5924F84EF50061BF55 /* SDLDeviceStatus.h in Headers */,
- B3992629258C24130048F09B /* SDLKeyboardInputMask.h in Headers */,
4A8BD2CF24F93803000945E3 /* SDLTouchEvent.h in Headers */,
4ABB264B24F7F5580061BF55 /* SDLManagerDelegate.h in Headers */,
4A8BD28B24F934F3000945E3 /* SDLRGBColor.h in Headers */,
@@ -7055,7 +7064,6 @@
4ABB2AB524F847F40061BF55 /* SDLShowAppMenuResponse.h in Headers */,
4A8BD3C724F998A8000945E3 /* SDLWindowState.h in Headers */,
4ABB286424F828E00061BF55 /* SDLVehicleDataNotificationStatus.h in Headers */,
- B3992624258C1E490048F09B /* SDLKeyboardCapabilities.h in Headers */,
4ABB287C24F8294A0061BF55 /* SDLVentilationMode.h in Headers */,
4ABB292F24F842A00061BF55 /* SDLDeleteFile.h in Headers */,
4ABB294924F843440061BF55 /* SDLEncodedSyncPData.h in Headers */,
@@ -7185,6 +7193,7 @@
4ABB2AB024F847F40061BF55 /* SDLSetCloudAppPropertiesResponse.h in Headers */,
4ABB28C524F82A6A0061BF55 /* SDLOnEncodedSyncPData.h in Headers */,
4ABB2A5924F847B10061BF55 /* SDLGetCloudAppPropertiesResponse.h in Headers */,
+ 4AAB6A1225E57BEA0017A5A7 /* SDLSystemInfo.h in Headers */,
4ABB29BF24F845DB0061BF55 /* SDLSetMediaClockTimer.h in Headers */,
4A8BD39324F94731000945E3 /* SDLIAPTransport.h in Headers */,
4ABB2A2024F847980061BF55 /* SDLButtonPressResponse.h in Headers */,
@@ -7293,7 +7302,6 @@
4ABB2A3124F847980061BF55 /* SDLDeleteFileResponse.h in Headers */,
4ABB294C24F843440061BF55 /* SDLEndAudioPassThru.h in Headers */,
4ABB2AD524F848130061BF55 /* SDLSubscribeVehicleDataResponse.h in Headers */,
- B3992634258C276B0048F09B /* SDLConfigurableKeyboards.h in Headers */,
4ABB251224F7E3A30061BF55 /* SDLLifecycleConfiguration.h in Headers */,
4ABB25F624F7E7EF0061BF55 /* SDLTouch.h in Headers */,
4ABB2A8324F847DF0061BF55 /* SDLResetGlobalPropertiesResponse.h in Headers */,
@@ -7703,7 +7711,7 @@
attributes = {
CLASSPREFIX = SDL;
LastSwiftUpdateCheck = 0710;
- LastUpgradeCheck = 1210;
+ LastUpgradeCheck = 1240;
ORGANIZATIONNAME = smartdevicelink;
TargetAttributes = {
5D4019AE1A76EC350006B0C2 = {
@@ -7871,21 +7879,18 @@
4ABB2AD224F848130061BF55 /* SDLSubscribeWayPointsResponse.m in Sources */,
4ABB286224F828E00061BF55 /* SDLVehicleDataResultCode.m in Sources */,
4ABB2B8A24F8504A0061BF55 /* SDLHMISettingsControlCapabilities.m in Sources */,
- B3992623258C1E490048F09B /* SDLKeyboardCapabilities.m in Sources */,
4ABB257A24F7E5FF0061BF55 /* SDLPresentKeyboardOperation.m in Sources */,
4ABB27CA24F8006D0061BF55 /* SDLMediaType.m in Sources */,
4ABB264524F7F5340061BF55 /* SDLSystemCapabilityManager.m in Sources */,
4A8BD2B124F935BC000945E3 /* SDLSoftButtonCapabilities.m in Sources */,
4ABB2A5524F847B10061BF55 /* SDLGetInteriorVehicleDataConsentResponse.m in Sources */,
4ABED25B257681ED005BDF61 /* SDLVoiceCommandUpdateOperation.m in Sources */,
- B3A9D9E125D2571000CDFD21 /* SDLKeyboardCapabilities.m in Sources */,
4ABB2AA924F847F40061BF55 /* SDLSetAppIconResponse.m in Sources */,
4A8BD2D224F93803000945E3 /* SDLTemplateColorScheme.m in Sources */,
4A8BD3C124F994D5000945E3 /* SDLFileManager.m in Sources */,
4ABB25A324F7E6CE0061BF55 /* SDLDynamicMenuUpdateAlgorithm.m in Sources */,
4A8BD30C24F938D6000945E3 /* SDLWeatherAlert.m in Sources */,
4ABB250924F596920061BF55 /* SDLFileWrapper.m in Sources */,
- B399262A258C24130048F09B /* SDLKeyboardInputMask.m in Sources */,
4ABB24E324F5948D0061BF55 /* SDLEncryptionConfiguration.m in Sources */,
4ABB273D24F7FD1D0061BF55 /* SDLDimension.m in Sources */,
4ABB267B24F7F6840061BF55 /* SDLIconArchiveFile.m in Sources */,
@@ -8121,6 +8126,7 @@
4ABB2AA824F847F40061BF55 /* SDLSetDisplayLayoutResponse.m in Sources */,
4ABB273E24F7FD1D0061BF55 /* SDLDisplayMode.m in Sources */,
4A40254124FFDA660080E159 /* SDLTextAndGraphicState.m in Sources */,
+ 4AAB6A1325E57BEA0017A5A7 /* SDLSystemInfo.m in Sources */,
4ABB27AB24F7FFDA0061BF55 /* SDLMassageZone.m in Sources */,
4A8BD2DD24F93803000945E3 /* SDLTouchEvent.m in Sources */,
4ABB26BD24F7FA1C0061BF55 /* SDLLogConfiguration.m in Sources */,
@@ -8207,7 +8213,6 @@
4ABB251724F7E3AC0061BF55 /* SDLLifecycleConfigurationUpdate.m in Sources */,
4ABB24F824F5959E0061BF55 /* SDLAsynchronousOperation.m in Sources */,
4A8BD37624F9465E000945E3 /* SDLProtocol.m in Sources */,
- B3992633258C276B0048F09B /* SDLConfigurableKeyboards.m in Sources */,
4A8BD34D24F945E8000945E3 /* SDLControlFramePayloadRPCStartService.m in Sources */,
4A8BD36524F9461A000945E3 /* SDLV2ProtocolMessage.m in Sources */,
4ABB29BE24F845DB0061BF55 /* SDLSlider.m in Sources */,
@@ -8216,6 +8221,7 @@
4ABB2B9F24F850AE0061BF55 /* SDLImageResolution.m in Sources */,
4ABB29B424F845DB0061BF55 /* SDLSpeak.m in Sources */,
4A8BD3AF24F98ACE000945E3 /* SDLLogManager.m in Sources */,
+ 4A39C6FA25E84C87005C8943 /* SDLKeyboardCapabilities.m in Sources */,
4ABB257124F7E5E80061BF55 /* SDLPresentChoiceSetOperation.m in Sources */,
4ABB2A5624F847B10061BF55 /* SDLGetWayPointsResponse.m in Sources */,
4ABB24F524F595120061BF55 /* SDLArtwork.m in Sources */,
@@ -8418,7 +8424,6 @@
1680B11E1A9CD7AD00DBD79E /* SDLProtocolReceivedMessageRouterSpec.m in Sources */,
162E82FD1A9BDE8B00906325 /* SDLSystemContextSpec.m in Sources */,
162E82E21A9BDE8B00906325 /* SDLIgnitionStableStatusSpec.m in Sources */,
- B3992642258FAAE00048F09B /* SDLConfigurableKeyboardsSpec.m in Sources */,
162E82EE1A9BDE8B00906325 /* SDLMediaClockFormatSpec.m in Sources */,
5D76751822D921CB00E8D71A /* SDLMenuLayoutSpec.m in Sources */,
5DA026901AD44EE700019F86 /* SDLDialNumberResponseSpec.m in Sources */,
@@ -8637,6 +8642,7 @@
5D92935620B2FD7300FCC775 /* SDLTemplateColorSchemeSpec.m in Sources */,
162E82DE1A9BDE8B00906325 /* SDLFuelCutoffStatusSpec.m in Sources */,
162E83271A9BDE8B00906325 /* SDLCreateInteractionChoiceSetSpec.m in Sources */,
+ 4AAB6A2325E69D010017A5A7 /* SDLSystemInfoSpec.m in Sources */,
4A404C68250BBE2B003AB65D /* SDLTextAndGraphicStateSpec.m in Sources */,
5DAD5F8920508F090025624C /* SDLSoftButtonStateSpec.m in Sources */,
1098F03824A39699004F53CC /* SDLPermissionElementSpec.m in Sources */,
@@ -8705,7 +8711,6 @@
162E82FE1A9BDE8B00906325 /* SDLTBTStateSpec.m in Sources */,
5DB1BCD41D243A8E002FFC37 /* SDLListFilesOperationSpec.m in Sources */,
8863747E22D650DE00D2671F /* SDLCloseApplicationSpec.m in Sources */,
- B3992650258FABF70048F09B /* SDLKeyboardInputMaskSpec.m in Sources */,
162E834B1A9BDE8B00906325 /* SDLAlertManeuverResponseSpec.m in Sources */,
162E833E1A9BDE8B00906325 /* SDLShowSpec.m in Sources */,
5D6035D8202CF5C900A429C9 /* TestRequestProgressResponse.m in Sources */,
@@ -8715,7 +8720,6 @@
162E82EF1A9BDE8B00906325 /* SDLPermissionStatusSpec.m in Sources */,
881F388D22D904BE00DF6DCE /* SDLCancelInteractionResponseSpec.m in Sources */,
8BA12B1822DCF59700371E82 /* SDLUnpublishAppServiceResponseSpec.m in Sources */,
- B399264A258FAB6B0048F09B /* SDLKeyboardCapabilitiesSpec.m in Sources */,
DA9F7EA61DCC05F500ACAE48 /* SDLUnsubscribeWaypointsSpec.m in Sources */,
1E89B0E2203196B800A47992 /* SDLSeatControlCapabilitiesSpec.m in Sources */,
162E82F01A9BDE8B00906325 /* SDLPowerModeQualificationStatusSpec.m in Sources */,
diff --git a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink-Example-ObjC.xcscheme b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink-Example-ObjC.xcscheme
index 144ab0c4b..bc2631407 100644
--- a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink-Example-ObjC.xcscheme
+++ b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink-Example-ObjC.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "1210"
+ LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
diff --git a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink.xcscheme b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink.xcscheme
index a9b412148..33ef694da 100644
--- a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink.xcscheme
+++ b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLink.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "1210"
+ LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
diff --git a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLinkSwift.xcscheme b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLinkSwift.xcscheme
index 55446e4f2..de1c185e3 100644
--- a/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLinkSwift.xcscheme
+++ b/SmartDeviceLink-iOS.xcodeproj/xcshareddata/xcschemes/SmartDeviceLinkSwift.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "1210"
+ LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
diff --git a/SmartDeviceLink/private/SDLConnectionManagerType.h b/SmartDeviceLink/private/SDLConnectionManagerType.h
index 2602a7315..21cd8d3ab 100644
--- a/SmartDeviceLink/private/SDLConnectionManagerType.h
+++ b/SmartDeviceLink/private/SDLConnectionManagerType.h
@@ -12,12 +12,15 @@
@class SDLRPCRequest;
@class SDLRPCMessage;
@class SDLRegisterAppInterfaceResponse;
-
+@class SDLSystemInfo;
NS_ASSUME_NONNULL_BEGIN
@protocol SDLConnectionManagerType <NSObject>
+/// An object describing the properties of the connected module
+@property (strong, nonatomic, nullable) SDLSystemInfo *systemInfo;
+
/**
* A special method on the connection manager which is used by managers that must bypass the default block on RPC sends before managers complete setup.
*
diff --git a/SmartDeviceLink/private/SDLControlFramePayloadConstants.h b/SmartDeviceLink/private/SDLControlFramePayloadConstants.h
index e0bd1d5e8..ecdd4c954 100644
--- a/SmartDeviceLink/private/SDLControlFramePayloadConstants.h
+++ b/SmartDeviceLink/private/SDLControlFramePayloadConstants.h
@@ -11,18 +11,24 @@
extern int32_t const SDLControlFrameInt32NotFound;
extern int64_t const SDLControlFrameInt64NotFound;
-extern char *const SDLControlFrameProtocolVersionKey;
+extern char *const SDLControlFrameAudioServiceTransportsKey;
+extern char *const SDLControlFrameAuthTokenKey;
extern char *const SDLControlFrameHashIdKey;
+extern char *const SDLControlFrameHeightKey;
extern char *const SDLControlFrameMTUKey;
+extern char *const SDLControlFrameProtocolVersionKey;
extern char *const SDLControlFrameReasonKey;
extern char *const SDLControlFrameRejectedParams;
-extern char *const SDLControlFrameVideoProtocolKey;
-extern char *const SDLControlFrameVideoCodecKey;
-extern char *const SDLControlFrameHeightKey;
-extern char *const SDLControlFrameWidthKey;
extern char *const SDLControlFrameSecondaryTransportsKey;
-extern char *const SDLControlFrameAudioServiceTransportsKey;
-extern char *const SDLControlFrameVideoServiceTransportsKey;
extern char *const SDLControlFrameTCPIPAddressKey;
extern char *const SDLControlFrameTCPPortKey;
-extern char *const SDLControlFrameAuthTokenKey;
+extern char *const SDLControlFrameVehicleMakeKey;
+extern char *const SDLControlFrameVehicleModelKey;
+extern char *const SDLControlFrameVehicleModelYearKey;
+extern char *const SDLControlFrameVehicleHardwareVersionKey;
+extern char *const SDLControlFrameVehicleSoftwareVersionKey;
+extern char *const SDLControlFrameVehicleTrimKey;
+extern char *const SDLControlFrameVideoCodecKey;
+extern char *const SDLControlFrameVideoProtocolKey;
+extern char *const SDLControlFrameVideoServiceTransportsKey;
+extern char *const SDLControlFrameWidthKey;
diff --git a/SmartDeviceLink/private/SDLControlFramePayloadConstants.m b/SmartDeviceLink/private/SDLControlFramePayloadConstants.m
index c365c78a8..1d3e19b98 100644
--- a/SmartDeviceLink/private/SDLControlFramePayloadConstants.m
+++ b/SmartDeviceLink/private/SDLControlFramePayloadConstants.m
@@ -11,18 +11,24 @@
int32_t const SDLControlFrameInt32NotFound = -1;
int64_t const SDLControlFrameInt64NotFound = -1;
-char *const SDLControlFrameProtocolVersionKey = "protocolVersion";
-char *const SDLControlFrameHashIdKey = "hashId";
-char *const SDLControlFrameMTUKey = "mtu";
-char *const SDLControlFrameSecondaryTransportsKey = "secondaryTransports";
char *const SDLControlFrameAudioServiceTransportsKey = "audioServiceTransports";
-char *const SDLControlFrameVideoServiceTransportsKey = "videoServiceTransports";
char *const SDLControlFrameAuthTokenKey = "authToken";
+char *const SDLControlFrameHashIdKey = "hashId";
+char *const SDLControlFrameHeightKey = "height";
+char *const SDLControlFrameMTUKey = "mtu";
+char *const SDLControlFrameProtocolVersionKey = "protocolVersion";
char *const SDLControlFrameRejectedParams = "rejectedParams";
char *const SDLControlFrameReasonKey = "reason";
+char *const SDLControlFrameSecondaryTransportsKey = "secondaryTransports";
+char *const SDLControlFrameTCPIPAddressKey = "tcpIpAddress";
+char *const SDLControlFrameTCPPortKey = "tcpPort";
+char *const SDLControlFrameVehicleHardwareVersionKey = "systemHardwareVersion";
+char *const SDLControlFrameVehicleMakeKey = "make";
+char *const SDLControlFrameVehicleModelKey = "model";
+char *const SDLControlFrameVehicleModelYearKey = "modelYear";
+char *const SDLControlFrameVehicleSoftwareVersionKey = "systemSoftwareVersion";
+char *const SDLControlFrameVehicleTrimKey = "trim";
char *const SDLControlFrameVideoProtocolKey = "videoProtocol";
char *const SDLControlFrameVideoCodecKey = "videoCodec";
-char *const SDLControlFrameHeightKey = "height";
char *const SDLControlFrameWidthKey = "width";
-char *const SDLControlFrameTCPIPAddressKey = "tcpIpAddress";
-char *const SDLControlFrameTCPPortKey = "tcpPort";
+char *const SDLControlFrameVideoServiceTransportsKey = "videoServiceTransports";
diff --git a/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.h b/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.h
index 295204aac..27e860b64 100644
--- a/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.h
+++ b/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.h
@@ -35,7 +35,51 @@ NS_ASSUME_NONNULL_BEGIN
/** List of transports that are allowed to carry video service. The values can be either 1 (primary transport) or 2 (secondary transport) and are listed in preferred order. */
@property (copy, nonatomic, readonly, nullable) NSArray<NSNumber *> *videoServiceTransports;
-- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu authToken:(nullable NSString *)authToken protocolVersion:(nullable NSString *)protocolVersion secondaryTransports:(nullable NSArray<NSString *> *)secondaryTransports audioServiceTransports:(nullable NSArray<NSNumber *> *)audioServiceTransports videoServiceTransports:(nullable NSArray<NSNumber *> *)videoServiceTransports;
+/// The connected vehicle make, e.g. "Ford", "Toyota", or "Subaru"
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *make;
+
+/// The connected vehicle model, e.g. "Bronco", "Tundra", "Outback"
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *model;
+
+/// The connected vehicle trim, e.g. "ST"
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *trim;
+
+/// The connected vehicle model year, e.g. "2021"
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *modelYear;
+
+/// The connected vehicle module software version
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *systemSoftwareVersion;
+
+/// The connected vehicle module hardware version
+///
+/// Added in Protocol Spec 5.4
+@property (copy, nonatomic, readonly, nullable) NSString *systemHardwareVersion;
+
+/// Initialize a StartServiceACK Control Frame Payload
+/// @param hashId A hash identifying the connection
+/// @param mtu The size of a packet that can be sent over this connection without dividing it into separate packets
+/// @param authToken A cloud app authorization token
+/// @param protocolVersion The version of the protocol this connection runs over
+/// @param secondaryTransports Array of available secondary transports
+/// @param audioServiceTransports Array of transports the audio service may travel on
+/// @param videoServiceTransports Array of transports the video service may travel on
+/// @param make The connected vehicle make, e.g. "Ford", "Toyota", or "Subaru"
+/// @param model The connected vehicle model, e.g. "Bronco", "Tundra", "Outback"
+/// @param trim The connected vehicle trim, e.g. "ST"
+/// @param modelYear The connected vehicle model year, e.g. "2021"
+/// @param systemSoftwareVersion The connected vehicle module software version
+/// @param systemHardwareVersion The connected vehicle module hardware version
+- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu authToken:(nullable NSString *)authToken protocolVersion:(nullable NSString *)protocolVersion secondaryTransports:(nullable NSArray<NSString *> *)secondaryTransports audioServiceTransports:(nullable NSArray<NSNumber *> *)audioServiceTransports videoServiceTransports:(nullable NSArray<NSNumber *> *)videoServiceTransports make:(nullable NSString *)make model:(nullable NSString *)model trim:(nullable NSString *)trim modelYear:(nullable NSString *)modelYear systemSoftwareVersion:(nullable NSString *)systemSoftwareVersion systemHardwareVersion:(nullable NSString *)systemHardwareVersion;
@end
diff --git a/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.m b/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.m
index e6afae672..afa5ace28 100644
--- a/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.m
+++ b/SmartDeviceLink/private/SDLControlFramePayloadRPCStartServiceAck.m
@@ -23,19 +23,19 @@ NS_ASSUME_NONNULL_BEGIN
@property (copy, nonatomic, readwrite, nullable) NSArray<NSString *> *secondaryTransports;
@property (copy, nonatomic, readwrite, nullable) NSArray<NSNumber *> *audioServiceTransports;
@property (copy, nonatomic, readwrite, nullable) NSArray<NSNumber *> *videoServiceTransports;
+@property (copy, nonatomic, readwrite, nullable) NSString *make;
+@property (copy, nonatomic, readwrite, nullable) NSString *model;
+@property (copy, nonatomic, readwrite, nullable) NSString *trim;
+@property (copy, nonatomic, readwrite, nullable) NSString *modelYear;
+@property (copy, nonatomic, readwrite, nullable) NSString *systemSoftwareVersion;
+@property (copy, nonatomic, readwrite, nullable) NSString *systemHardwareVersion;
@end
@implementation SDLControlFramePayloadRPCStartServiceAck
-- (instancetype)initWithHashId:(int32_t)hashId
- mtu:(int64_t)mtu
- authToken:(nullable NSString *)authToken
- protocolVersion:(nullable NSString *)protocolVersion
- secondaryTransports:(nullable NSArray<NSString *> *)secondaryTransports
- audioServiceTransports:(nullable NSArray<NSNumber *> *)audioServiceTransports
- videoServiceTransports:(nullable NSArray<NSNumber *> *)videoServiceTransports {
+- (instancetype)initWithHashId:(int32_t)hashId mtu:(int64_t)mtu authToken:(nullable NSString *)authToken protocolVersion:(nullable NSString *)protocolVersion secondaryTransports:(nullable NSArray<NSString *> *)secondaryTransports audioServiceTransports:(nullable NSArray<NSNumber *> *)audioServiceTransports videoServiceTransports:(nullable NSArray<NSNumber *> *)videoServiceTransports make:(nullable NSString *)make model:(nullable NSString *)model trim:(nullable NSString *)trim modelYear:(nullable NSString *)modelYear systemSoftwareVersion:(nullable NSString *)systemSoftwareVersion systemHardwareVersion:(nullable NSString *)systemHardwareVersion {
self = [super init];
if (!self) return nil;
@@ -46,6 +46,12 @@ NS_ASSUME_NONNULL_BEGIN
_secondaryTransports = secondaryTransports;
_audioServiceTransports = audioServiceTransports;
_videoServiceTransports = videoServiceTransports;
+ _make = make;
+ _model = model;
+ _trim = trim;
+ _modelYear = modelYear;
+ _systemSoftwareVersion = systemSoftwareVersion;
+ _systemHardwareVersion = systemHardwareVersion;
return self;
}
@@ -105,6 +111,30 @@ NS_ASSUME_NONNULL_BEGIN
[self sdl_addServiceTransports:&payloadObject fromArray:self.audioServiceTransports forKey:SDLControlFrameAudioServiceTransportsKey];
[self sdl_addServiceTransports:&payloadObject fromArray:self.videoServiceTransports forKey:SDLControlFrameVideoServiceTransportsKey];
+ if (self.make != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleMakeKey, (char *)self.make.UTF8String);
+ }
+
+ if (self.model != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleModelKey, (char *)self.model.UTF8String);
+ }
+
+ if (self.trim != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleTrimKey, (char *)self.trim.UTF8String);
+ }
+
+ if (self.modelYear != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleModelYearKey, (char *)self.modelYear.UTF8String);
+ }
+
+ if (self.systemSoftwareVersion != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleSoftwareVersionKey, (char *)self.systemSoftwareVersion.UTF8String);
+ }
+
+ if (self.systemHardwareVersion != nil) {
+ bson_object_put_string(&payloadObject, SDLControlFrameVehicleHardwareVersionKey, (char *)self.systemHardwareVersion.UTF8String);
+ }
+
BytePtr bsonData = bson_object_to_bytes(&payloadObject);
NSUInteger length = bson_object_size(&payloadObject);
@@ -148,6 +178,36 @@ NS_ASSUME_NONNULL_BEGIN
self.audioServiceTransports = [self sdl_getServiceTransports:&payloadObject forKey:SDLControlFrameAudioServiceTransportsKey];
self.videoServiceTransports = [self sdl_getServiceTransports:&payloadObject forKey:SDLControlFrameVideoServiceTransportsKey];
+ char *makeString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleMakeKey);
+ if (makeString != NULL) {
+ self.make = [NSString stringWithUTF8String:makeString];
+ }
+
+ char *modelString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleModelKey);
+ if (modelString != NULL) {
+ self.model = [NSString stringWithUTF8String:modelString];
+ }
+
+ char *trimString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleTrimKey);
+ if (trimString != NULL) {
+ self.trim = [NSString stringWithUTF8String:trimString];
+ }
+
+ char *modelYearString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleModelYearKey);
+ if (modelYearString != NULL) {
+ self.modelYear = [NSString stringWithUTF8String:modelYearString];
+ }
+
+ char *softwareVersionString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleSoftwareVersionKey);
+ if (softwareVersionString != NULL) {
+ self.systemSoftwareVersion = [NSString stringWithUTF8String:softwareVersionString];
+ }
+
+ char *hardwareVersionString = bson_object_get_string(&payloadObject, SDLControlFrameVehicleHardwareVersionKey);
+ if (hardwareVersionString != NULL) {
+ self.systemHardwareVersion = [NSString stringWithUTF8String:hardwareVersionString];
+ }
+
bson_object_deinitialize(&payloadObject);
}
diff --git a/SmartDeviceLink/private/SDLEncryptionLifecycleManager.m b/SmartDeviceLink/private/SDLEncryptionLifecycleManager.m
index 8206a021f..a8f7b488d 100644
--- a/SmartDeviceLink/private/SDLEncryptionLifecycleManager.m
+++ b/SmartDeviceLink/private/SDLEncryptionLifecycleManager.m
@@ -25,6 +25,7 @@
#import "SDLRPCResponseNotification.h"
#import "SDLServiceEncryptionDelegate.h"
#import "SDLStateMachine.h"
+#import "SDLSystemInfo.h"
#import "SDLVehicleType.h"
NS_ASSUME_NONNULL_BEGIN
@@ -80,7 +81,6 @@ typedef NSString SDLVehicleMake;
}
}
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_registerAppInterfaceResponseReceived:) name:SDLDidReceiveRegisterAppInterfaceResponse object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_permissionsDidChange:) name:SDLDidChangePermissionsNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_hmiLevelDidChange:) name:SDLDidChangeHMIStatusNotification object:nil];
@@ -92,7 +92,13 @@ typedef NSString SDLVehicleMake;
- (void)startWithProtocol:(SDLProtocol *)protocol {
SDLLogD(@"Starting encryption manager");
_protocol = protocol;
-
+
+ // Set the security manager based on the known system info
+ self.protocol.securityManager = [self sdl_securityManagerForMake:self.connectionManager.systemInfo.vehicleType.make];
+ if ((self.protocol.securityManager != nil) && [self.protocol.securityManager respondsToSelector:@selector(setAppId:)]) {
+ self.protocol.securityManager.appId = self.configuration.lifecycleConfig.fullAppId ? self.configuration.lifecycleConfig.fullAppId : self.configuration.lifecycleConfig.appId;
+ }
+
@synchronized(self.protocol.protocolDelegateTable) {
if (![self.protocol.protocolDelegateTable containsObject:self]) {
[self.protocol.protocolDelegateTable addObject:self];
@@ -238,16 +244,6 @@ typedef NSString SDLVehicleMake;
#pragma mark - Notifications
-- (void)sdl_registerAppInterfaceResponseReceived:(SDLRPCResponseNotification *)notification {
- if (![notification isResponseMemberOfClass:[SDLRegisterAppInterfaceResponse class]]) { return; }
-
- SDLRegisterAppInterfaceResponse *registerResponse = notification.response;
- self.protocol.securityManager = [self sdl_securityManagerForMake:registerResponse.vehicleType.make];
- if (self.protocol.securityManager && [self.protocol.securityManager respondsToSelector:@selector(setAppId:)]) {
- self.protocol.securityManager.appId = self.configuration.lifecycleConfig.fullAppId ? self.configuration.lifecycleConfig.fullAppId : self.configuration.lifecycleConfig.appId;
- }
-}
-
- (void)sdl_hmiLevelDidChange:(SDLRPCNotificationNotification *)notification {
if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) { return; }
diff --git a/SmartDeviceLink/private/SDLGlobals.m b/SmartDeviceLink/private/SDLGlobals.m
index 5bfa5796a..c9a36c6c2 100644
--- a/SmartDeviceLink/private/SDLGlobals.m
+++ b/SmartDeviceLink/private/SDLGlobals.m
@@ -15,7 +15,7 @@
NS_ASSUME_NONNULL_BEGIN
// VERSION DEPENDENT CODE
-NSString *const SDLMaxProxyProtocolVersion = @"5.3.0";
+NSString *const SDLMaxProxyProtocolVersion = @"5.4.0";
NSString *const SDLMaxProxyRPCVersion = @"7.1.0";
NSUInteger const SDLDefaultMTUSize = UINT32_MAX;
diff --git a/SmartDeviceLink/private/SDLLifecycleManager.h b/SmartDeviceLink/private/SDLLifecycleManager.h
index 1911c4877..fdda17f40 100644
--- a/SmartDeviceLink/private/SDLLifecycleManager.h
+++ b/SmartDeviceLink/private/SDLLifecycleManager.h
@@ -35,6 +35,7 @@
@class SDLStateMachine;
@class SDLStreamingMediaManager;
@class SDLSystemCapabilityManager;
+@class SDLSystemInfo;
@protocol SDLManagerDelegate;
@@ -83,6 +84,7 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
@property (copy, nonatomic, nullable) SDLVideoStreamingState videoStreamingState;
@property (copy, nonatomic, nullable) SDLSystemContext systemContext;
@property (strong, nonatomic, nullable) SDLRegisterAppInterfaceResponse *registerResponse;
+@property (strong, nonatomic, nullable) SDLSystemInfo *systemInfo;
@property (strong, nonatomic) NSOperationQueue *rpcOperationQueue;
diff --git a/SmartDeviceLink/private/SDLLifecycleManager.m b/SmartDeviceLink/private/SDLLifecycleManager.m
index c81dc6dd0..f71223bc9 100644
--- a/SmartDeviceLink/private/SDLLifecycleManager.m
+++ b/SmartDeviceLink/private/SDLLifecycleManager.m
@@ -60,6 +60,7 @@
#import "SDLStreamingMediaConfiguration.h"
#import "SDLStreamingMediaManager.h"
#import "SDLSystemCapabilityManager.h"
+#import "SDLSystemInfo.h"
#import "SDLTCPTransport.h"
#import "SDLUnregisterAppInterface.h"
#import "SDLVersion.h"
@@ -374,6 +375,21 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
return;
}
+ // If we received vehicle details in the protocol layer, we need to check if the developer wants to disconnect
+ self.systemInfo = self.protocolHandler.protocol.systemInfo;
+ if (self.systemInfo != nil) {
+ SDLLogD(@"System info received via protocol layer: %@", self.systemInfo);
+ if ([self.delegate respondsToSelector:@selector(didReceiveSystemInfo:)]) {
+ BOOL shouldConnect = [self.delegate didReceiveSystemInfo:self.systemInfo];
+ if (!shouldConnect) {
+ SDLLogW(@"Developer chose to disconnect from the head unit; disconnecting now");
+ [self.protocolHandler.protocol endServiceWithType:SDLServiceTypeRPC];
+ [self sdl_transitionToState:SDLLifecycleStateStopped];
+ return;
+ }
+ }
+ }
+
// Build a register app interface request with the configuration data
SDLRegisterAppInterface *regRequest = [[SDLRegisterAppInterface alloc] initWithLifecycleConfiguration:self.configuration.lifecycleConfig];
@@ -396,7 +412,7 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
weakSelf.registerResponse = (SDLRegisterAppInterfaceResponse *)response;
[SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithSDLMsgVersion:weakSelf.registerResponse.sdlMsgVersion];
- SDLLogD(@"Did register app; RPC version: %@, SDL version: %@, starting languages: (VR) %@, (HMI) %@, vehicle type: %@", weakSelf.registerResponse.sdlMsgVersion, (weakSelf.registerResponse.sdlVersion ?: @"unavailable"), weakSelf.registerResponse.language, weakSelf.registerResponse.hmiDisplayLanguage, weakSelf.registerResponse.vehicleType);
+ SDLLogD(@"Did register app; RPC version: %@, starting languages: (VR) %@, (HMI) %@", weakSelf.registerResponse.sdlMsgVersion, weakSelf.registerResponse.language, weakSelf.registerResponse.hmiDisplayLanguage);
[weakSelf sdl_transitionToState:SDLLifecycleStateRegistered];
}];
@@ -410,6 +426,29 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
return;
}
+ // If we did not receive vehicle details in the protocol layer, we need to check if the developer wants to disconnect based on vehicle details from the RAIR
+ if (self.systemInfo == nil) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ SDLVehicleType *vehicleType = self.registerResponse.vehicleType;
+ NSString *softwareVersion = self.registerResponse.systemSoftwareVersion;
+#pragma clang diagnostic pop
+ if ((vehicleType != nil) || (softwareVersion != nil)) {
+ self.systemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softwareVersion hardwareVersion:nil];
+ SDLLogD(@"System info received by RPC layer, using RAIR system info: %@", self.systemInfo);
+
+ if ([self.delegate respondsToSelector:@selector(didReceiveSystemInfo:)]) {
+ BOOL shouldConnect = [self.delegate didReceiveSystemInfo:self.systemInfo];
+ if (!shouldConnect) {
+ SDLLogW(@"Developer chose to disconnect from the head unit; disconnecting now");
+ [self.protocolHandler.protocol endServiceWithType:SDLServiceTypeRPC];
+ [self sdl_transitionToState:SDLLifecycleStateStopped];
+ return;
+ }
+ }
+ }
+ }
+
NSArray<SDLLanguage> *supportedLanguages = self.configuration.lifecycleConfig.languagesSupported;
SDLLanguage desiredHMILanguage = self.configuration.lifecycleConfig.language;
SDLLanguage desiredVRLanguage = self.currentVRLanguage;
diff --git a/SmartDeviceLink/private/SDLProtocol.h b/SmartDeviceLink/private/SDLProtocol.h
index a9a21f66d..9fdc25192 100644
--- a/SmartDeviceLink/private/SDLProtocol.h
+++ b/SmartDeviceLink/private/SDLProtocol.h
@@ -13,6 +13,7 @@
@class SDLProtocolHeader;
@class SDLProtocolRecievedMessageRouter;
@class SDLRPCMessage;
+@class SDLSystemInfo;
NS_ASSUME_NONNULL_BEGIN
@@ -65,6 +66,9 @@ extern NSString *const SDLProtocolSecurityErrorDomain;
*/
@property (strong, nonatomic, readonly, nullable) NSString *authToken;
+/// The connected module's information if it's available
+@property (strong, nonatomic, readonly, nullable) SDLSystemInfo *systemInfo;
+
#pragma mark - Init
- (instancetype)init NS_UNAVAILABLE;
diff --git a/SmartDeviceLink/private/SDLProtocol.m b/SmartDeviceLink/private/SDLProtocol.m
index a76e6a24d..348543801 100644
--- a/SmartDeviceLink/private/SDLProtocol.m
+++ b/SmartDeviceLink/private/SDLProtocol.m
@@ -9,8 +9,10 @@
#import "SDLControlFramePayloadEndService.h"
#import "SDLControlFramePayloadNak.h"
#import "SDLControlFramePayloadRegisterSecondaryTransportNak.h"
+#import "SDLControlFramePayloadAudioStartServiceAck.h"
#import "SDLControlFramePayloadRPCStartService.h"
#import "SDLControlFramePayloadRPCStartServiceAck.h"
+#import "SDLControlFramePayloadVideoStartServiceAck.h"
#import "SDLEncryptionLifecycleManager.h"
#import "SDLLogMacros.h"
#import "SDLGlobals.h"
@@ -25,6 +27,7 @@
#import "SDLRPCRequest.h"
#import "SDLRPCResponse.h"
#import "SDLSecurityType.h"
+#import "SDLSystemInfo.h"
#import "SDLTimer.h"
#import "SDLVersion.h"
#import "SDLV2ProtocolHeader.h"
@@ -50,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
// Readonly public properties
@property (strong, nonatomic, readwrite, nullable) NSString *authToken;
+@property (strong, nonatomic, readwrite, nullable) SDLSystemInfo *systemInfo;
@end
@@ -513,7 +517,6 @@ NS_ASSUME_NONNULL_BEGIN
switch (startServiceACK.header.serviceType) {
case SDLServiceTypeRPC: {
SDLControlFramePayloadRPCStartServiceAck *startServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:startServiceACK.payload];
-
if (startServiceACKPayload.mtu != SDLControlFrameInt64NotFound) {
[[SDLGlobals sharedGlobals] setDynamicMTUSize:(NSUInteger)startServiceACKPayload.mtu forServiceType:startServiceACK.header.serviceType];
}
@@ -523,20 +526,20 @@ NS_ASSUME_NONNULL_BEGIN
[SDLGlobals sharedGlobals].maxHeadUnitProtocolVersion = (startServiceACKPayload.protocolVersion != nil) ? [SDLVersion versionWithString:startServiceACKPayload.protocolVersion] : [SDLVersion versionWithMajor:startServiceACK.header.version minor:0 patch:0];
- self.authToken = [SDLGlobals.sharedGlobals.maxHeadUnitProtocolVersion isGreaterThanOrEqualToVersion:[[SDLVersion alloc] initWithMajor:5 minor:2 patch:0]] ? startServiceACKPayload.authToken : nil;
+ self.authToken = startServiceACKPayload.authToken;
- // TODO: Hash id?
+ if ((startServiceACKPayload.make != nil) || (startServiceACKPayload.systemHardwareVersion != nil) || (startServiceACKPayload.systemSoftwareVersion != nil)) {
+ self.systemInfo = [[SDLSystemInfo alloc] initWithMake:startServiceACKPayload.make model:startServiceACKPayload.model trim:startServiceACKPayload.trim modelYear:startServiceACKPayload.modelYear softwareVersion:startServiceACKPayload.systemSoftwareVersion hardwareVersion:startServiceACKPayload.systemHardwareVersion];
+ }
} break;
case SDLServiceTypeAudio: {
- SDLControlFramePayloadRPCStartServiceAck *startServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:startServiceACK.payload];
-
+ SDLControlFramePayloadAudioStartServiceAck *startServiceACKPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithData:startServiceACK.payload];
if (startServiceACKPayload.mtu != SDLControlFrameInt64NotFound) {
[[SDLGlobals sharedGlobals] setDynamicMTUSize:(NSUInteger)startServiceACKPayload.mtu forServiceType:SDLServiceTypeAudio];
}
} break;
case SDLServiceTypeVideo: {
- SDLControlFramePayloadRPCStartServiceAck *startServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:startServiceACK.payload];
-
+ SDLControlFramePayloadVideoStartServiceAck *startServiceACKPayload = [[SDLControlFramePayloadVideoStartServiceAck alloc] initWithData:startServiceACK.payload];
if (startServiceACKPayload.mtu != SDLControlFrameInt64NotFound) {
[[SDLGlobals sharedGlobals] setDynamicMTUSize:(NSUInteger)startServiceACKPayload.mtu forServiceType:SDLServiceTypeVideo];
}
diff --git a/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m
index 5e77bb305..4a3195613 100644
--- a/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m
+++ b/SmartDeviceLink/private/SDLStreamingAudioLifecycleManager.m
@@ -15,6 +15,7 @@
#import "SDLControlFramePayloadConstants.h"
#import "SDLControlFramePayloadNak.h"
#import "SDLDisplayCapabilities.h"
+#import "SDLEncryptionConfiguration.h"
#import "SDLGlobals.h"
#import "SDLHMICapabilities.h"
#import "SDLLogMacros.h"
@@ -28,7 +29,7 @@
#import "SDLStateMachine.h"
#import "SDLStreamingMediaConfiguration.h"
#import "SDLSystemCapabilityManager.h"
-#import "SDLEncryptionConfiguration.h"
+#import "SDLSystemInfo.h"
#import "SDLVehicleType.h"
NS_ASSUME_NONNULL_BEGIN
@@ -44,7 +45,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) SDLProtocol *protocol;
@property (copy, nonatomic) NSArray<NSString *> *secureMakes;
-@property (copy, nonatomic, nullable) NSString *connectedVehicleMake;
@property (assign, nonatomic, readwrite, getter=isAudioEncrypted) BOOL audioEncrypted;
@property (nonatomic, copy, nullable) void (^audioServiceEndedCompletionHandler)(void);
@@ -72,7 +72,6 @@ NS_ASSUME_NONNULL_BEGIN
_audioStreamStateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLAudioStreamManagerStateStopped states:[self.class sdl_audioStreamingStateTransitionDictionary]];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_didReceiveRegisterAppInterfaceResponse:) name:SDLDidReceiveRegisterAppInterfaceResponse object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_hmiLevelDidChange:) name:SDLDidChangeHMIStatusNotification object:nil];
return self;
@@ -96,7 +95,6 @@ NS_ASSUME_NONNULL_BEGIN
SDLLogD(@"Stopping manager");
_protocol = nil;
_hmiLevel = SDLHMILevelNone;
- _connectedVehicleMake = nil;
[self.audioTranscodingManager stop];
[self.audioStreamStateMachine transitionToState:SDLAudioStreamManagerStateStopped];
@@ -162,7 +160,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didEnterStateAudioStreamStarting {
SDLLogD(@"Audio stream starting");
- if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:self.connectedVehicleMake])) {
+
+ NSString *connectedVehicleMake = self.connectionManager.systemInfo.vehicleType.make;
+ if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:connectedVehicleMake])) {
[self.protocol startSecureServiceWithType:SDLServiceTypeAudio payload:nil tlsInitializationHandler:^(BOOL success, NSError * _Nonnull error) {
if (error) {
SDLLogE(@"TLS setup error: %@", error);
@@ -227,18 +227,6 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - SDL RPC Notification callbacks
-- (void)sdl_didReceiveRegisterAppInterfaceResponse:(SDLRPCResponseNotification *)notification {
- NSAssert([notification.response isKindOfClass:[SDLRegisterAppInterfaceResponse class]], @"A notification was sent with an unanticipated object");
- if (![notification.response isKindOfClass:[SDLRegisterAppInterfaceResponse class]]) {
- return;
- }
-
- SDLLogV(@"Received Register App Interface response");
- SDLRegisterAppInterfaceResponse *registerResponse = (SDLRegisterAppInterfaceResponse*)notification.response;
-
- self.connectedVehicleMake = registerResponse.vehicleType.make;
-}
-
- (void)sdl_hmiLevelDidChange:(SDLRPCNotificationNotification *)notification {
NSAssert([notification.notification isKindOfClass:[SDLOnHMIStatus class]], @"A notification was sent with an unanticipated object");
if (![notification.notification isKindOfClass:[SDLOnHMIStatus class]]) {
diff --git a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m
index d2b5490ee..16236e6b7 100644
--- a/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m
+++ b/SmartDeviceLink/private/SDLStreamingVideoLifecycleManager.m
@@ -42,6 +42,7 @@
#import "SDLStreamingVideoScaleManager.h"
#import "SDLSystemCapability.h"
#import "SDLSystemCapabilityManager.h"
+#import "SDLSystemInfo.h"
#import "SDLTouchManager.h"
#import "SDLVehicleType.h"
#import "SDLVideoEncoderDelegate.h"
@@ -71,7 +72,6 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
@property (strong, nonatomic) NSMutableDictionary *videoEncoderSettings;
@property (copy, nonatomic) NSDictionary<NSString *, id> *customEncoderSettings;
@property (copy, nonatomic) NSArray<NSString *> *secureMakes;
-@property (copy, nonatomic, nullable) NSString *connectedVehicleMake;
@property (copy, nonatomic, readonly) NSString *appName;
@property (assign, nonatomic) CV_NULLABLE CVPixelBufferRef backgroundingPixelBuffer;
@@ -199,7 +199,6 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
_protocol = nil;
[self.videoScaleManager stop];
[self.focusableItemManager stop];
- _connectedVehicleMake = nil;
[self.videoStreamStateMachine transitionToState:SDLVideoStreamManagerStateStopped];
}
@@ -597,7 +596,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
return;
}
- SDLLogD(@"Received Register App Interface");
+ SDLLogV(@"Received Register App Interface");
SDLRegisterAppInterfaceResponse *registerResponse = (SDLRegisterAppInterfaceResponse *)notification.response;
#pragma clang diagnostic push
@@ -608,15 +607,16 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
self.videoScaleManager.displayViewportResolution = CGSizeMake(resolution.resolutionWidth.floatValue,
resolution.resolutionHeight.floatValue);
// HAX: Workaround for Legacy Ford and Lincoln displays with > 800 resolution width or height. They don't support scaling and if we don't do this workaround, they will not correctly scale the view.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
NSString *make = registerResponse.vehicleType.make;
+#pragma clang diagnostic pop
CGSize resolution = self.videoScaleManager.displayViewportResolution;
if (([make containsString:@"Ford"] || [make containsString:@"Lincoln"]) && (resolution.width > 800 || resolution.height > 800)) {
self.videoScaleManager.scale = 1.0f / 0.75f; // Scale by 1.333333
}
}
- self.connectedVehicleMake = registerResponse.vehicleType.make;
-
SDLLogD(@"Determined base screen size on display capabilities: %@", NSStringFromCGSize(self.videoScaleManager.displayViewportResolution));
}
@@ -798,7 +798,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
SDLControlFramePayloadVideoStartService *startVideoPayload = [[SDLControlFramePayloadVideoStartService alloc] initWithVideoHeight:preferredResolution.resolutionHeight.intValue width:preferredResolution.resolutionWidth.intValue protocol:preferredFormat.protocol codec:preferredFormat.codec];
// Decide if we need to start a secure service or not
- if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:self.connectedVehicleMake])) {
+ NSString *connectedVehicleMake = self.connectionManager.systemInfo.vehicleType.make;
+ if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:connectedVehicleMake])) {
SDLLogD(@"Sending secure video start service with payload: %@", startVideoPayload);
[self.protocol startSecureServiceWithType:SDLServiceTypeVideo payload:startVideoPayload.data tlsInitializationHandler:^(BOOL success, NSError *error) {
if (error) {
diff --git a/SmartDeviceLink/public/SDLManagerDelegate.h b/SmartDeviceLink/public/SDLManagerDelegate.h
index 2b01af879..5b3d6a981 100644
--- a/SmartDeviceLink/public/SDLManagerDelegate.h
+++ b/SmartDeviceLink/public/SDLManagerDelegate.h
@@ -13,6 +13,7 @@
#import "SDLSystemContext.h"
#import "SDLLifecycleConfigurationUpdate.h"
#import "SDLLanguage.h"
+#import "SDLSystemInfo.h"
#import "SDLVideoStreamingState.h"
NS_ASSUME_NONNULL_BEGIN
@@ -67,6 +68,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable SDLLifecycleConfigurationUpdate *)managerShouldUpdateLifecycleToLanguage:(SDLLanguage)language hmiLanguage:(SDLLanguage)hmiLanguage;
+/**
+ * A way to determine if this SDL session should continue to be active while connected to the determined system information of the vehicle.
+ * @param systemInfo The system information of the vehicle that this session is currently active on.
+ * @return True if this session should continue, false if the session should end
+ */
+- (BOOL)didReceiveSystemInfo:(SDLSystemInfo *)systemInfo NS_SWIFT_NAME(didReceive(systemInfo:));
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/public/SDLRegisterAppInterfaceResponse.h b/SmartDeviceLink/public/SDLRegisterAppInterfaceResponse.h
index 3538e22e3..ea037da92 100644
--- a/SmartDeviceLink/public/SDLRegisterAppInterfaceResponse.h
+++ b/SmartDeviceLink/public/SDLRegisterAppInterfaceResponse.h
@@ -147,13 +147,13 @@ NS_ASSUME_NONNULL_BEGIN
@property (nullable, strong, nonatomic) SDLAudioPassThruCapabilities *pcmStreamCapabilities;
/**
- * Specifies the connected vehicle's type.
+ * Specifies the vehicle's type. See VehicleType.
*
- * SDLVehicleType, Optional
+ * @deprecated in SmartDeviceLink 7.1.0
*
- * @since SDL 2.0
+ * @added in SmartDeviceLink 2.0.0
*/
-@property (nullable, strong, nonatomic) SDLVehicleType *vehicleType;
+@property (nullable, strong, nonatomic) SDLVehicleType *vehicleType __deprecated_msg("Implement SDLManager.delegate.didReceiveSystemInfo instead");
/**
* Specifies the white-list of supported diagnostic modes (0x00-0xFF) capable for DiagnosticMessage requests. If a mode outside this list is requested, it will be rejected.
@@ -184,12 +184,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
* The software version of the system that implements the SmartDeviceLink core.
+ *
+ * {"string_min_length": 1, "string_max_length": 100}
*
- * String, Optional, Max length: 100
+ * @deprecated in SDL 7.1.0
*
- * @since SDL 3.0
+ * @added in SDL 3.0.0
*/
-@property (nullable, strong, nonatomic) NSString *systemSoftwareVersion;
+@property (nullable, strong, nonatomic) NSString *systemSoftwareVersion __deprecated_msg("Implement SDLManager.delegate.didReceiveSystemInfo instead");
/**
* Existence of apps icon at system. If true, apps icon was resumed at system. If false, apps icon is not resumed at system.
diff --git a/SmartDeviceLink/public/SDLSystemInfo.h b/SmartDeviceLink/public/SDLSystemInfo.h
new file mode 100644
index 000000000..0a14f7fb8
--- /dev/null
+++ b/SmartDeviceLink/public/SDLSystemInfo.h
@@ -0,0 +1,43 @@
+//
+// SDLSystemInfo.h
+// SmartDeviceLink
+//
+// Created by Joel Fischer on 2/23/21.
+// Copyright © 2021 smartdevicelink. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@class SDLVehicleType;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SDLSystemInfo : NSObject
+
+/// The connected module's vehicle type: it's make, model, trim, and model year
+@property (strong, nonatomic, readonly, nullable) SDLVehicleType *vehicleType;
+
+/// The connected module's software version
+@property (strong, nonatomic, readonly, nullable) NSString *systemSoftwareVersion;
+
+/// The connected module's hardware version
+@property (strong, nonatomic, readonly, nullable) NSString *systemHardwareVersion;
+
+/// Initialize a system info object with individual pieces
+/// @param make The vehicle's make
+/// @param model The vehicle's model
+/// @param trim The vehicle's trim
+/// @param modelYear The vehicle's model year
+/// @param softwareVersion The vehicle's software version
+/// @param hardwareVersion The vehicle's hardware version
+- (instancetype)initWithMake:(nullable NSString *)make model:(nullable NSString *)model trim:(nullable NSString *)trim modelYear:(nullable NSString *)modelYear softwareVersion:(nullable NSString *)softwareVersion hardwareVersion:(nullable NSString *)hardwareVersion;
+
+/// Initialize a system info object with the vehicle type and versions
+/// @param vehicleType The vehicle information
+/// @param softwareVersion The vehicle's software version
+/// @param hardwareVersion The vehicle's hardware version
+- (instancetype)initWithVehicleType:(nullable SDLVehicleType *)vehicleType softwareVersion:(nullable NSString *)softwareVersion hardwareVersion:(nullable NSString *)hardwareVersion;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/public/SDLSystemInfo.m b/SmartDeviceLink/public/SDLSystemInfo.m
new file mode 100644
index 000000000..8b0df3100
--- /dev/null
+++ b/SmartDeviceLink/public/SDLSystemInfo.m
@@ -0,0 +1,49 @@
+//
+// SDLSystemInfo.m
+// SmartDeviceLink
+//
+// Created by Joel Fischer on 2/23/21.
+// Copyright © 2021 smartdevicelink. All rights reserved.
+//
+
+#import "SDLSystemInfo.h"
+
+#import "SDLVehicleType.h"
+
+@interface SDLSystemInfo ()
+
+@property (strong, nonatomic, readwrite, nullable) SDLVehicleType *vehicleType;
+@property (strong, nonatomic, readwrite, nullable) NSString *systemSoftwareVersion;
+@property (strong, nonatomic, readwrite, nullable) NSString *systemHardwareVersion;
+
+@end
+
+@implementation SDLSystemInfo
+
+- (instancetype)initWithMake:(nullable NSString *)make model:(nullable NSString *)model trim:(nullable NSString *)trim modelYear:(nullable NSString *)modelYear softwareVersion:(nullable NSString *)softwareVersion hardwareVersion:(nullable NSString *)hardwareVersion {
+ self = [super init];
+ if (!self) { return nil; }
+
+ _vehicleType = [[SDLVehicleType alloc] initWithMake:make model:model modelYear:modelYear trim:trim];
+ _systemSoftwareVersion = softwareVersion;
+ _systemHardwareVersion = hardwareVersion;
+
+ return self;
+}
+
+- (instancetype)initWithVehicleType:(nullable SDLVehicleType *)vehicleType softwareVersion:(nullable NSString *)softwareVersion hardwareVersion:(nullable NSString *)hardwareVersion {
+ self = [super init];
+ if (!self) { return nil; }
+
+ _vehicleType = vehicleType;
+ _systemSoftwareVersion = softwareVersion;
+ _systemHardwareVersion = hardwareVersion;
+
+ return self;
+}
+
+- (NSString *)description {
+ return [NSString stringWithFormat:@"Vehicle Type: %@, software version: %@, hardware version: %@", _vehicleType, _systemSoftwareVersion, _systemHardwareVersion];
+}
+
+@end
diff --git a/SmartDeviceLink/public/SDLVehicleType.h b/SmartDeviceLink/public/SDLVehicleType.h
index 0c9c100dc..f2a4da7ca 100644
--- a/SmartDeviceLink/public/SDLVehicleType.h
+++ b/SmartDeviceLink/public/SDLVehicleType.h
@@ -49,6 +49,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nonatomic, nullable) NSString *trim;
+/**
+ * Initialize the object
+ *
+ * @param make - make
+ * @param model - model
+ * @param modelYear - modelYear
+ * @param trim - trim
+ * @return A SDLVehicleType object
+ */
+- (instancetype)initWithMake:(nullable NSString *)make model:(nullable NSString *)model modelYear:(nullable NSString *)modelYear trim:(nullable NSString *)trim;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/public/SDLVehicleType.m b/SmartDeviceLink/public/SDLVehicleType.m
index 5f3df0700..15a47b9f0 100644
--- a/SmartDeviceLink/public/SDLVehicleType.m
+++ b/SmartDeviceLink/public/SDLVehicleType.m
@@ -11,6 +11,18 @@ NS_ASSUME_NONNULL_BEGIN
@implementation SDLVehicleType
+- (instancetype)initWithMake:(nullable NSString *)make model:(nullable NSString *)model modelYear:(nullable NSString *)modelYear trim:(nullable NSString *)trim {
+ self = [self init];
+ if (!self) {
+ return nil;
+ }
+ self.make = make;
+ self.model = model;
+ self.modelYear = modelYear;
+ self.trim = trim;
+ return self;
+}
+
- (void)setMake:(nullable NSString *)make {
[self.store sdl_setObject:make forName:SDLRPCParameterNameMake];
}
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index 8d2cf9dbc..4d7f71d93 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -43,10 +43,10 @@
#import "SDLTTSChunk.h"
#import "SDLUnregisterAppInterface.h"
#import "SDLUnregisterAppInterfaceResponse.h"
+#import "SDLVehicleType.h"
#import "SDLVersion.h"
#import "SDLVideoStreamingState.h"
-
@interface SDLStreamingMediaManager ()
@property (strong, nonatomic, nullable) SDLSecondaryTransportManager *secondaryTransportManager;
@@ -91,7 +91,7 @@ QuickSpecBegin(SDLLifecycleManagerSpec)
describe(@"a lifecycle manager", ^{
__block SDLLifecycleManager *testManager = nil;
__block SDLConfiguration *testConfig = nil;
- __block id protocolMock = nil;
+ __block SDLProtocol *protocolMock = nil;
__block id sdlManagerDelegateProtocolMock = nil;
__block id lockScreenManagerMock = nil;
__block id fileManagerMock = nil;
@@ -100,6 +100,9 @@ describe(@"a lifecycle manager", ^{
__block id systemCapabilityMock = nil;
__block id secondaryTransportManagerMock = nil;
__block id encryptionManagerMock = nil;
+ SDLVehicleType *vehicleType = [[SDLVehicleType alloc] initWithMake:@"Make" model:@"Model" modelYear:@"Model Year" trim:@"Trim"];
+ NSString *softwareVersion = @"1.1.1.1";
+ NSString *hardwareVersion = @"2.2.2.2";
void (^transitionToState)(SDLState *) = ^(SDLState *state) {
dispatch_sync(testManager.lifecycleQueue, ^{
@@ -253,11 +256,35 @@ describe(@"a lifecycle manager", ^{
beforeEach(^{
// When we connect, we should be creating an sending an RAI
OCMExpect([protocolMock sendRPC:[OCMArg isKindOfClass:[SDLRegisterAppInterface class]]]);
-
- [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
+ });
+
+ context(@"when the protocol system info is set", ^{
+ SDLSystemInfo *testSystemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softwareVersion hardwareVersion:hardwareVersion];
+
+ beforeEach(^{
+ OCMStub(protocolMock.systemInfo).andReturn(testSystemInfo);
+ OCMExpect([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isEqual:testSystemInfo]]).andReturn(YES);
+ [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
+ });
+
+ it(@"should call the delegate handler", ^{
+ OCMVerifyAllWithDelay(sdlManagerDelegateProtocolMock, 1.0);
+ });
+ });
+
+ context(@"when the protocol system info is not set", ^{
+ beforeEach(^{
+ OCMStub(protocolMock.systemInfo).andReturn(nil);
+ [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
+ });
+
+ it(@"should call the delegate handler", ^{
+ OCMReject([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNil]]);
+ });
});
it(@"should send a register app interface request and be in the connected state", ^{
+ [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
OCMVerifyAllWithDelay(protocolMock, 1.0);
expect(testManager.lifecycleState).toEventually(equal(SDLLifecycleStateConnected));
});
@@ -266,6 +293,7 @@ describe(@"a lifecycle manager", ^{
describe(@"after receiving a disconnect notification", ^{
beforeEach(^{
+ [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
[testManager.notificationDispatcher postNotificationName:SDLTransportDidDisconnect infoObject:nil];
[NSThread sleepForTimeInterval:0.1];
});
@@ -277,6 +305,7 @@ describe(@"a lifecycle manager", ^{
describe(@"stopping the manager", ^{
it(@"should simply stop", ^{
+ [testManager.notificationDispatcher postNotificationName:SDLRPCServiceDidConnect infoObject:nil];
[testManager stop];
expect(testManager.lifecycleState).toEventually(equal(SDLLifecycleStateStopped));
@@ -324,6 +353,138 @@ describe(@"a lifecycle manager", ^{
itBehavesLike(@"unable to send an RPC", ^{ return @{ @"manager": testManager }; });
});
+
+ context(@"when the protocol system info is not set", ^{
+ beforeEach(^{
+ testManager.systemInfo = nil;
+ OCMExpect([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNotNil]]).andReturn(YES);
+ });
+
+ it(@"should call the delegate handler", ^{
+ SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
+ response.resultCode = SDLResultSuccess;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ response.vehicleType = vehicleType;
+ response.systemSoftwareVersion = softwareVersion;
+#pragma clang diagnostic pop
+ testManager.registerResponse = response;
+ [testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:YES];
+
+ OCMVerifyAllWithDelay(sdlManagerDelegateProtocolMock, 1.0);
+ });
+ });
+
+ context(@"when the protocol system info is set", ^{
+ SDLSystemInfo *testSystemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softwareVersion hardwareVersion:hardwareVersion];
+
+ beforeEach(^{
+ testManager.systemInfo = testSystemInfo;
+ });
+
+ it(@"should call not the delegate handler", ^{
+ SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
+ response.resultCode = SDLResultSuccess;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ response.vehicleType = vehicleType;
+ response.systemSoftwareVersion = softwareVersion;
+#pragma clang diagnostic pop
+ [testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:YES];
+
+ OCMReject([sdlManagerDelegateProtocolMock didReceiveSystemInfo:[OCMArg isNotNil]]);
+ });
+ });
+
+ context(@"when the register response returns different language than the one passed with the lifecycle configuration", ^{
+ it(@"should should update the configuration when the app supports the head unit language", ^{
+ SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
+ registerAppInterfaceResponse.success = @YES;
+ registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
+ registerAppInterfaceResponse.info = @"Language mismatch";
+ registerAppInterfaceResponse.language = SDLLanguageEnGb;
+ registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
+ testManager.registerResponse = registerAppInterfaceResponse;
+
+ SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"E" ttsName:[SDLTTSChunk textChunksFromString:@"EnGb ttsName"] voiceRecognitionCommandNames:@[@"EnGb", @"Gb"]];
+ OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(update);
+
+ OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
+ SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
+ expect(changeRegistration.appName).to(equal(update.appName));
+ expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
+ expect(changeRegistration.ttsName).to(equal(update.ttsName));
+ expect(changeRegistration.vrSynonyms).to(equal(@[@"EnGb", @"Gb"]));
+ return [value isKindOfClass:[SDLChangeRegistration class]];
+ }]]);
+
+ setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
+
+ OCMVerifyAllWithDelay(protocolMock, 0.5);
+
+ expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnGb));
+ expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnGb));
+ expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"EnGb"));
+ expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"E"));
+ expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(equal([SDLTTSChunk textChunksFromString:@"EnGb ttsName"]));
+ });
+
+ it(@"should not update the configuration when the app does not support the head unit language or display language", ^{
+ SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
+ registerAppInterfaceResponse.success = @YES;
+ registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
+ registerAppInterfaceResponse.info = @"Language mismatch";
+ registerAppInterfaceResponse.language = SDLLanguageDeDe;
+ registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageDeDe;
+ testManager.registerResponse = registerAppInterfaceResponse;
+
+ OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(nil);
+
+ setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
+
+ OCMVerifyAllWithDelay(protocolMock, 0.5);
+
+ expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnUs));
+ expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnUs));
+ expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"Test App"));
+ expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"Short Name"));
+ expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(beNil());
+ });
+
+ it(@"should update when the app supports the head unit display language", ^{
+ SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
+ registerAppInterfaceResponse.success = @YES;
+ registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
+ registerAppInterfaceResponse.info = @"Language mismatch";
+ registerAppInterfaceResponse.language = SDLLanguageEnUs;
+ registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
+ testManager.registerResponse = registerAppInterfaceResponse;
+
+ SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"Gb" ttsName:nil voiceRecognitionCommandNames:nil];
+ OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:registerAppInterfaceResponse.language hmiLanguage:registerAppInterfaceResponse.hmiDisplayLanguage]).andReturn(update);
+
+ setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
+
+ OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
+ SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
+ expect(changeRegistration.appName).to(equal(update.appName));
+ expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
+ expect(changeRegistration.ttsName).to(beNil());
+ expect(changeRegistration.vrSynonyms).to(beNil());
+ return [value isKindOfClass:[SDLChangeRegistration class]];
+ }]]);
+
+ setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
+
+ OCMVerifyAllWithDelay(protocolMock, 0.5);
+
+ expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnGb));
+ expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnUs));
+ expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"EnGb"));
+ expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"Gb"));
+ expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(beNil());
+ });
+ });
describe(@"after receiving a disconnect notification", ^{
beforeEach(^{
@@ -361,7 +522,7 @@ describe(@"a lifecycle manager", ^{
});
});
- describe(@"transitioning to the Setting Up HMI state", ^{
+ describe(@"transitioning from setting app icon state to the Setting Up HMI state", ^{
context(@"before register response is a success", ^{
it(@"ready handler should not be called yet", ^{
SDLRegisterAppInterfaceResponse *response = [[SDLRegisterAppInterfaceResponse alloc] init];
@@ -399,7 +560,7 @@ describe(@"a lifecycle manager", ^{
});
});
- describe(@"transitioning to the ready state", ^{
+ describe(@"transitioning from the registered state to the ready state", ^{
beforeEach(^{
[testManager.lifecycleStateMachine setToState:SDLLifecycleStateRegistered fromOldState:nil callEnterTransition:NO];
});
@@ -432,96 +593,6 @@ describe(@"a lifecycle manager", ^{
expect(readyHandlerError.userInfo[NSLocalizedFailureReasonErrorKey]).toEventually(match(response.info));
});
});
-
- context(@"when the register response returns different language than the one passed with the lifecycle configuration", ^{
- it(@"should should update the configuration when the app supports the head unit language", ^{
- SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- registerAppInterfaceResponse.success = @YES;
- registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
- registerAppInterfaceResponse.info = @"Language mismatch";
- registerAppInterfaceResponse.language = SDLLanguageEnGb;
- registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
- testManager.registerResponse = registerAppInterfaceResponse;
-
- SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"E" ttsName:[SDLTTSChunk textChunksFromString:@"EnGb ttsName"] voiceRecognitionCommandNames:@[@"EnGb", @"Gb"]];
- OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(update);
-
- OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
- SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
- expect(changeRegistration.appName).to(equal(update.appName));
- expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
- expect(changeRegistration.ttsName).to(equal(update.ttsName));
- expect(changeRegistration.vrSynonyms).to(equal(@[@"EnGb", @"Gb"]));
- return [value isKindOfClass:[SDLChangeRegistration class]];
- }]]);
-
- setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
-
- OCMVerifyAllWithDelay(protocolMock, 0.5);
-
- expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnGb));
- expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnGb));
- expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"EnGb"));
- expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"E"));
- expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(equal([SDLTTSChunk textChunksFromString:@"EnGb ttsName"]));
- });
-
- it(@"should not update the configuration when the app does not support the head unit language or display language", ^{
- SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- registerAppInterfaceResponse.success = @YES;
- registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
- registerAppInterfaceResponse.info = @"Language mismatch";
- registerAppInterfaceResponse.language = SDLLanguageDeDe;
- registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageDeDe;
- testManager.registerResponse = registerAppInterfaceResponse;
-
- OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:[OCMArg any] hmiLanguage:[OCMArg any]]).andReturn(nil);
-
- setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
-
- OCMVerifyAllWithDelay(protocolMock, 0.5);
-
- expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnUs));
- expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnUs));
- expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"Test App"));
- expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"Short Name"));
- expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(beNil());
- });
-
- it(@"should update when the app supports the head unit display language", ^{
- SDLRegisterAppInterfaceResponse *registerAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- registerAppInterfaceResponse.success = @YES;
- registerAppInterfaceResponse.resultCode = SDLResultWrongLanguage;
- registerAppInterfaceResponse.info = @"Language mismatch";
- registerAppInterfaceResponse.language = SDLLanguageEnUs;
- registerAppInterfaceResponse.hmiDisplayLanguage = SDLLanguageEnGb;
- testManager.registerResponse = registerAppInterfaceResponse;
-
- SDLLifecycleConfigurationUpdate *update = [[SDLLifecycleConfigurationUpdate alloc] initWithAppName:@"EnGb" shortAppName:@"Gb" ttsName:nil voiceRecognitionCommandNames:nil];
- OCMStub([testManager.delegate managerShouldUpdateLifecycleToLanguage:registerAppInterfaceResponse.language hmiLanguage:registerAppInterfaceResponse.hmiDisplayLanguage]).andReturn(update);
-
- transitionToState(SDLLifecycleStateUpdatingConfiguration);
-
- OCMExpect([protocolMock sendRPC:[OCMArg checkWithBlock:^BOOL(id value) {
- SDLChangeRegistration *changeRegistration = (SDLChangeRegistration *)value;
- expect(changeRegistration.appName).to(equal(update.appName));
- expect(changeRegistration.ngnMediaScreenAppName).to(equal(update.shortAppName));
- expect(changeRegistration.ttsName).to(beNil());
- expect(changeRegistration.vrSynonyms).to(beNil());
- return [value isKindOfClass:[SDLChangeRegistration class]];
- }]]);
-
- setToStateWithEnterTransition(SDLLifecycleStateRegistered, SDLLifecycleStateUpdatingConfiguration);
-
- OCMVerifyAllWithDelay(protocolMock, 0.5);
-
- expect(testManager.configuration.lifecycleConfig.language).toEventually(equal(SDLLanguageEnGb));
- expect(testManager.currentVRLanguage).toEventually(equal(SDLLanguageEnUs));
- expect(testManager.configuration.lifecycleConfig.appName).toEventually(equal(@"EnGb"));
- expect(testManager.configuration.lifecycleConfig.shortAppName).toEventually(equal(@"Gb"));
- expect(testManager.configuration.lifecycleConfig.ttsName).toEventually(beNil());
- });
- });
});
describe(@"in the ready state", ^{
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m
index 4a39a0676..cca65997b 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingAudioLifecycleManagerSpec.m
@@ -27,7 +27,6 @@
@interface SDLStreamingAudioLifecycleManager()
@property (weak, nonatomic) SDLProtocol *protocol;
-@property (copy, nonatomic, nullable) NSString *connectedVehicleMake;
@property (nonatomic, strong, readwrite) SDLAudioStreamManager *audioTranscodingManager;
@end
@@ -98,32 +97,11 @@ describe(@"the streaming audio manager", ^{
expect(streamingLifecycleManager.currentAudioStreamState).to(match(SDLAudioStreamManagerStateStopped));
});
- describe(@"after receiving a register app interface response", ^{
- __block SDLRegisterAppInterfaceResponse *someRegisterAppInterfaceResponse = nil;
- __block SDLVehicleType *testVehicleType = nil;
-
- beforeEach(^{
- someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
- testVehicleType = [[SDLVehicleType alloc] init];
- testVehicleType.make = @"TestVehicleType";
- someRegisterAppInterfaceResponse.vehicleType = testVehicleType;
-
- SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse];
-
- [[NSNotificationCenter defaultCenter] postNotification:notification];
- });
-
- it(@"should should save the connected vehicle make", ^{
- expect(streamingLifecycleManager.connectedVehicleMake).toEventually(equal(testVehicleType.make));
- });
- });
-
describe(@"if the app state is active", ^{
__block id streamStub = nil;
beforeEach(^{
streamStub = OCMPartialMock(streamingLifecycleManager);
-
OCMStub([streamStub isStreamingSupported]).andReturn(YES);
[streamingLifecycleManager.appStateMachine setToState:SDLAppStateActive fromOldState:nil callEnterTransition:NO];
@@ -395,7 +373,6 @@ describe(@"the streaming audio manager", ^{
[streamingLifecycleManager endAudioServiceWithCompletionHandler:^ {
handlerCalled = YES;
}];
- streamingLifecycleManager.connectedVehicleMake = @"OEM_make_2";
});
context(@"when the manager is READY", ^{
@@ -409,7 +386,6 @@ describe(@"the streaming audio manager", ^{
expect(streamingLifecycleManager.protocol).to(beNil());
expect(streamingLifecycleManager.hmiLevel).to(equal(SDLHMILevelNone));
- expect(streamingLifecycleManager.connectedVehicleMake).to(beNil());
OCMVerify([mockAudioStreamManager stop]);
expect(handlerCalled).to(beTrue());
});
@@ -426,7 +402,6 @@ describe(@"the streaming audio manager", ^{
expect(streamingLifecycleManager.protocol).to(beNil());
expect(streamingLifecycleManager.hmiLevel).to(equal(SDLHMILevelNone));
- expect(streamingLifecycleManager.connectedVehicleMake).to(beNil());
OCMReject([mockAudioStreamManager stop]);
expect(handlerCalled).to(beFalse());
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
index 8543f4db0..4065b5077 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
@@ -49,7 +49,6 @@
@property (weak, nonatomic) SDLProtocol *protocol;
@property (copy, nonatomic, readonly) NSString *appName;
@property (copy, nonatomic, readonly) NSString *videoStreamBackgroundString;
-@property (copy, nonatomic, nullable) NSString *connectedVehicleMake;
@end
@@ -65,6 +64,7 @@ describe(@"the streaming video manager", ^{
__block SDLLifecycleConfiguration *testLifecycleConfiguration = [SDLLifecycleConfiguration defaultConfigurationWithAppName:testAppName fullAppId:@""];
__block SDLSystemCapabilityManager *testSystemCapabilityManager = nil;
__block SDLConfiguration *testConfig = nil;
+ SDLSystemInfo *testSystemInfo = [[SDLSystemInfo alloc] initWithMake:@"Livio" model:@"Model" trim:@"Trim" modelYear:@"2021" softwareVersion:@"1.1.1.1" hardwareVersion:@"2.2.2.2"];
__block void (^sendNotificationForHMILevel)(SDLHMILevel hmiLevel, SDLVideoStreamingState streamState) = ^(SDLHMILevel hmiLevel, SDLVideoStreamingState streamState) {
SDLOnHMIStatus *hmiStatus = [[SDLOnHMIStatus alloc] init];
@@ -81,6 +81,7 @@ describe(@"the streaming video manager", ^{
testConfiguration.dataSource = testDataSource;
testConfiguration.rootViewController = testViewController;
testConnectionManager = [[TestConnectionManager alloc] init];
+ testConnectionManager.systemInfo = testSystemInfo;
testLifecycleConfiguration.appType = SDLAppHMITypeNavigation;
@@ -158,7 +159,6 @@ describe(@"the streaming video manager", ^{
__block SDLScreenParams *someScreenParams = nil;
__block SDLImageResolution *someImageResolution = nil;
__block SDLHMICapabilities *someHMICapabilities = nil;
- __block SDLVehicleType *testVehicleType = nil;
beforeEach(^{
someImageResolution = [[SDLImageResolution alloc] init];
@@ -167,9 +167,6 @@ describe(@"the streaming video manager", ^{
someScreenParams = [[SDLScreenParams alloc] init];
someScreenParams.resolution = someImageResolution;
-
- testVehicleType = [[SDLVehicleType alloc] init];
- testVehicleType.make = @"TestVehicleType";
});
describe(@"that does not support video streaming", ^{
@@ -179,16 +176,14 @@ describe(@"the streaming video manager", ^{
someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
someRegisterAppInterfaceResponse.hmiCapabilities = someHMICapabilities;
- someRegisterAppInterfaceResponse.vehicleType = testVehicleType;
SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse];
[[NSNotificationCenter defaultCenter] postNotification:notification];
});
- it(@"should save the connected vehicle make but not the screen size", ^{
+ it(@"should not save the screen size", ^{
expect(@(CGSizeEqualToSize(streamingLifecycleManager.videoScaleManager.displayViewportResolution, CGSizeZero))).toEventually(equal(@YES));
- expect(streamingLifecycleManager.connectedVehicleMake).toEventually(equal(testVehicleType.make));
});
});
@@ -209,18 +204,14 @@ describe(@"the streaming video manager", ^{
#pragma clang diagnostic ignored "-Wdeprecated"
someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities;
#pragma clang diagnostic pop
- someRegisterAppInterfaceResponse.vehicleType = testVehicleType;
-
- someRegisterAppInterfaceResponse.vehicleType = testVehicleType;
SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse];
[[NSNotificationCenter defaultCenter] postNotification:notification];
});
- it(@"should save the connected vehicle make and the screen size", ^{
+ it(@"should save the screen size", ^{
expect(@(CGSizeEqualToSize(streamingLifecycleManager.videoScaleManager.displayViewportResolution, CGSizeMake(600, 100)))).toEventually(equal(@YES));
- expect(streamingLifecycleManager.connectedVehicleMake).toEventually(equal(testVehicleType.make));
});
});
});
@@ -774,7 +765,6 @@ describe(@"the streaming video manager", ^{
[streamingLifecycleManager endVideoServiceWithCompletionHandler:^ {
handlerCalled = YES;
}];
- streamingLifecycleManager.connectedVehicleMake = @"OEM_make_2";
});
context(@"when the manager is not stopped", ^{
@@ -786,7 +776,6 @@ describe(@"the streaming video manager", ^{
it(@"should transition to the stopped state", ^{
expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped));
expect(streamingLifecycleManager.protocol).to(beNil());
- expect(streamingLifecycleManager.connectedVehicleMake).to(beNil());
expect(streamingLifecycleManager.hmiLevel).to(equal(SDLHMILevelNone));
expect(streamingLifecycleManager.videoStreamingState).to(equal(SDLVideoStreamingStateNotStreamable));
expect(streamingLifecycleManager.preferredFormatIndex).to(equal(0));
@@ -804,7 +793,6 @@ describe(@"the streaming video manager", ^{
it(@"should stay in the stopped state", ^{
expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped));
expect(streamingLifecycleManager.protocol).to(beNil());
- expect(streamingLifecycleManager.connectedVehicleMake).to(beNil());
expect(streamingLifecycleManager.hmiLevel).to(equal(SDLHMILevelNone));
expect(streamingLifecycleManager.videoStreamingState).to(equal(SDLVideoStreamingStateNotStreamable));
expect(streamingLifecycleManager.preferredFormatIndex).to(equal(0));
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSystemInfoSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSystemInfoSpec.m
new file mode 100644
index 000000000..a1be29973
--- /dev/null
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSystemInfoSpec.m
@@ -0,0 +1,83 @@
+//
+// SDLSystemInfoSpec.m
+// SmartDeviceLinkTests
+//
+// Created by Joel Fischer on 2/24/21.
+// Copyright © 2021 smartdevicelink. All rights reserved.
+//
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLSystemInfo.h"
+#import "SDLVehicleType.h"
+
+QuickSpecBegin(SDLSystemInfoSpec)
+
+NSString *hardVersion = @"1.2.3";
+NSString *softVersion = @"9.8.7";
+NSString *make = @"Make";
+NSString *model = @"model";
+NSString *trim = @"trim";
+NSString *modelYear = @"2021";
+SDLVehicleType *vehicleType = [[SDLVehicleType alloc] initWithMake:make model:model modelYear:modelYear trim:trim];
+
+describe(@"system info", ^{
+ __block SDLSystemInfo *systemInfo = nil;
+
+ context(@"init", ^{
+ beforeEach(^{
+ systemInfo = [[SDLSystemInfo alloc] init];
+ });
+
+ it(@"expect all properties to be nil", ^{
+ expect(systemInfo).notTo(beNil());
+ expect(systemInfo.vehicleType).to(beNil());
+ expect(systemInfo.systemSoftwareVersion).to(beNil());
+ expect(systemInfo.systemHardwareVersion).to(beNil());
+ });
+ });
+
+ context(@"initWithMake:model:trim:modelYear:softwareVersion:hardwareVersion:", ^{
+ beforeEach(^{
+ systemInfo = [[SDLSystemInfo alloc] initWithMake:make model:model trim:trim modelYear:modelYear softwareVersion:softVersion hardwareVersion:hardVersion];
+ });
+
+ it(@"expect all properties to be set properly", ^{
+ expect(systemInfo).notTo(beNil());
+ expect(systemInfo.vehicleType.make).to(equal(make));
+ expect(systemInfo.vehicleType.model).to(equal(model));
+ expect(systemInfo.vehicleType.trim).to(equal(trim));
+ expect(systemInfo.vehicleType.modelYear).to(equal(modelYear));
+ expect(systemInfo.systemSoftwareVersion).to(equal(softVersion));
+ expect(systemInfo.systemHardwareVersion).to(equal(hardVersion));
+ });
+ });
+
+ context(@"initWithVehicleType:systemSoftwareVersion:systemHardwareVersion:", ^{
+ beforeEach(^{
+ systemInfo = [[SDLSystemInfo alloc] initWithVehicleType:vehicleType softwareVersion:softVersion hardwareVersion:hardVersion];
+ });
+
+ it(@"expect all properties to be set properly", ^{
+ expect(systemInfo).notTo(beNil());
+ expect(systemInfo.vehicleType).to(equal(vehicleType));
+ expect(systemInfo.systemSoftwareVersion).to(equal(softVersion));
+ expect(systemInfo.systemHardwareVersion).to(equal(hardVersion));
+ });
+ });
+
+ context(@"alloc and init", ^{
+ beforeEach(^{
+ systemInfo = [SDLSystemInfo alloc];
+ });
+
+ it(@"expect test object to be inited", ^{
+ expect(systemInfo.vehicleType).to(beNil());
+ expect(systemInfo.systemHardwareVersion).to(beNil());
+ expect(systemInfo.systemSoftwareVersion).to(beNil());
+ });
+ });
+});
+
+QuickSpecEnd
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLControlFramePayloadConstantsSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLControlFramePayloadConstantsSpec.m
index dba3e9a8b..480adbe27 100644
--- a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLControlFramePayloadConstantsSpec.m
+++ b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLControlFramePayloadConstantsSpec.m
@@ -17,21 +17,28 @@ describe(@"Individual Enum Value Tests", ^ {
it(@"Should match internal values", ^ {
expect(SDLControlFrameInt32NotFound).to(equal(-1));
expect(SDLControlFrameInt64NotFound).to(equal(-1));
- expect(SDLControlFrameProtocolVersionKey).to(equal(@"protocolVersion"));
+
+ expect(SDLControlFrameAuthTokenKey).to(equal(@"authToken"));
+ expect(SDLControlFrameAudioServiceTransportsKey).to(equal(@"audioServiceTransports"));
expect(SDLControlFrameHashIdKey).to(equal(@"hashId"));
+ expect(SDLControlFrameHeightKey).to(equal(@"height"));
expect(SDLControlFrameMTUKey).to(equal(@"mtu"));
- expect(SDLControlFrameSecondaryTransportsKey).to(equal(@"secondaryTransports"));
- expect(SDLControlFrameAudioServiceTransportsKey).to(equal(@"audioServiceTransports"));
- expect(SDLControlFrameVideoServiceTransportsKey).to(equal(@"videoServiceTransports"));
- expect(SDLControlFrameAuthTokenKey).to(equal(@"authToken"));
- expect(SDLControlFrameRejectedParams).to(equal(@"rejectedParams"));
+ expect(SDLControlFrameProtocolVersionKey).to(equal(@"protocolVersion"));
expect(SDLControlFrameReasonKey).to(equal(@"reason"));
- expect(SDLControlFrameVideoProtocolKey).to(equal(@"videoProtocol"));
- expect(SDLControlFrameVideoCodecKey).to(equal(@"videoCodec"));
- expect(SDLControlFrameHeightKey).to(equal(@"height"));
- expect(SDLControlFrameWidthKey).to(equal(@"width"));
+ expect(SDLControlFrameRejectedParams).to(equal(@"rejectedParams"));
+ expect(SDLControlFrameSecondaryTransportsKey).to(equal(@"secondaryTransports"));
expect(SDLControlFrameTCPIPAddressKey).to(equal(@"tcpIpAddress"));
expect(SDLControlFrameTCPPortKey).to(equal(@"tcpPort"));
+ expect(SDLControlFrameVehicleHardwareVersionKey).to(equal(@"systemHardwareVersion"));
+ expect(SDLControlFrameVehicleMakeKey).to(equal(@"make"));
+ expect(SDLControlFrameVehicleModelKey).to(equal(@"model"));
+ expect(SDLControlFrameVehicleModelYearKey).to(equal(@"modelYear"));
+ expect(SDLControlFrameVehicleSoftwareVersionKey).to(equal(@"systemSoftwareVersion"));
+ expect(SDLControlFrameVehicleTrimKey).to(equal(@"trim"));
+ expect(SDLControlFrameVideoCodecKey).to(equal(@"videoCodec"));
+ expect(SDLControlFrameVideoProtocolKey).to(equal(@"videoProtocol"));
+ expect(SDLControlFrameVideoServiceTransportsKey).to(equal(@"videoServiceTransports"));
+ expect(SDLControlFrameWidthKey).to(equal(@"width"));
});
});
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
index 483033569..ba5957369 100644
--- a/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
+++ b/SmartDeviceLinkTests/ProtocolSpecs/MessageSpecs/SDLProtocolSpec.m
@@ -10,8 +10,10 @@
#import <OCMock/OCMock.h>
#import "SDLTransportType.h"
+#import "SDLControlFramePayloadAudioStartServiceAck.h"
#import "SDLControlFramePayloadRegisterSecondaryTransportNak.h"
#import "SDLControlFramePayloadRPCStartServiceAck.h"
+#import "SDLControlFramePayloadVideoStartServiceAck.h"
#import "SDLGlobals.h"
#import "SDLProtocolHeader.h"
#import "SDLProtocol.h"
@@ -399,8 +401,15 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
__block id transportMock = nil;
__block SDLProtocol *testProtocol = nil;
__block id delegateMock = nil;
- __block int64_t testMTU = 989786483;
- __block int32_t hashId = 1545784;
+ int64_t testMTU = 989786483;
+ int32_t hashId = 1545784;
+ NSString *testAuthToken = @"testAuthToken";;
+ NSString *testMake = @"Livio";
+ NSString *testModel = @"Is";
+ NSString *testTrim = @"Awesome";
+ NSString *testModelYear = @"2021";
+ NSString *testSystemSoftwareVersion = @"1.1.1.1";
+ NSString *testSystemHardwareVersion = @"2.2.2.2";
beforeEach(^{
transportMock = OCMProtocolMock(@protocol(SDLTransportType));
@@ -413,15 +422,9 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
});
context(@"For protocol versions 5.0.0 and greater", ^{
- __block NSString *testAuthToken = nil;
-
- beforeEach(^{
- testAuthToken = @"testAuthToken";
- });
-
context(@"If the service type is RPC", ^{
- it(@"Should store the auth token and the protocol version and pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.2.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ it(@"Should store the auth token, system info, and the protocol version and pass the start service along to the delegate", ^{
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.2.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:testMake model:testModel trim:testTrim modelYear:testModelYear systemSoftwareVersion:testSystemSoftwareVersion systemHardwareVersion:testSystemHardwareVersion];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -445,7 +448,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
});
it(@"Should store the protocol version, but not get the auth token, and pass the start service along to the delegate if the protocol version is greater than 5.0.0 but less than 5.2.0", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -463,13 +466,13 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
OCMVerifyAllWithDelay(delegateMock, 0.1);
- expect(testProtocol.authToken).to(beNil());
+ expect(testProtocol.authToken).to(equal(testAuthToken));
expect([SDLGlobals sharedGlobals].protocolVersion.stringVersion).to(equal(@"5.1.0"));
expect([SDLGlobals sharedGlobals].maxHeadUnitProtocolVersion.stringVersion).to(equal(@"5.1.0"));
});
it(@"Should set the max head unit version using the header version if the protocol version is missing from the payload", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:nil secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:nil secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -495,7 +498,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is control", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -522,7 +525,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is Audio", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadAudioStartServiceAck *testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithMTU:testMTU];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -550,7 +553,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is Video", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:testAuthToken protocolVersion:@"5.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadVideoStartServiceAck *testPayload = [[SDLControlFramePayloadVideoStartServiceAck alloc] initWithMTU:testMTU height:0 width:0 protocol:nil codec:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -580,7 +583,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"For protocol versions below 5.0.0", ^{
context(@"If the service type is RPC", ^{
it(@"Should store the protocol version and pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"3.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"3.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
@@ -605,7 +608,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is not RPC", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"4.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"4.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:4];
@@ -630,7 +633,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is Audio", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"4.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadAudioStartServiceAck *testPayload = [[SDLControlFramePayloadAudioStartServiceAck alloc] initWithMTU:testMTU];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:4];
@@ -656,7 +659,7 @@ describe(@"HandleProtocolSessionStarted tests", ^ {
context(@"If the service type is Video", ^{
it(@"Should just pass the start service along to the delegate", ^{
- SDLControlFramePayloadRPCStartServiceAck *testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:hashId mtu:testMTU authToken:nil protocolVersion:@"4.1.0" secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ SDLControlFramePayloadVideoStartServiceAck *testPayload = [[SDLControlFramePayloadVideoStartServiceAck alloc] initWithMTU:testMTU height:0 width:0 protocol:nil codec:nil];
NSData *testData = testPayload.data;
SDLV2ProtocolHeader* testHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:4];
diff --git a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m
index 63e927d5f..a1e94e896 100644
--- a/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m
+++ b/SmartDeviceLinkTests/ProtocolSpecs/SDLControlFramePayloadRPCStartServiceAckSpec.m
@@ -9,136 +9,85 @@
QuickSpecBegin(SDLControlFramePayloadRPCStartServiceAckSpec)
-describe(@"Test encoding data", ^{
+describe(@"The payload", ^{
__block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil;
- __block int32_t testHashId = 0;
- __block int64_t testMTU = 0;
- __block NSString *testProtocolVersion = nil;
- __block NSArray<NSString *> *testSecondaryTransports = nil;
- __block NSArray<NSNumber *> *testAudioServiceTransports = nil;
- __block NSArray<NSNumber *> *testVideoServiceTransports = nil;
-
- context(@"with parameters", ^{
- beforeEach(^{
- testHashId = 1457689;
- testMTU = 5984649;
- testProtocolVersion = @"1.32.32";
-
- testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:nil protocolVersion:testProtocolVersion secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
+ __block NSData *testData = nil;
+ int32_t testHashId = 1457689;
+ int64_t testMTU = 5984649;
+ NSString *testProtocolVersion = @"1.32.32";
+ NSString *testAuthToken = @"Test Auth Token";
+ NSArray<NSString *> *testSecondaryTransports = @[@"TCP_WIFI", @"IAP_USB"];
+ NSArray<NSNumber *> *testAudioServiceTransports = @[@(2)];
+ NSArray<NSNumber *> *testVideoServiceTransports = @[@2, @1];
+ NSString *testMake = @"Livio";
+ NSString *testModel = @"Is";
+ NSString *testTrim = @"Awesome";
+ NSString *testModelYear = @"2021";
+ NSString *testSystemSoftwareVersion = @"1.1.1.1";
+ NSString *testSystemHardwareVersion = @"2.2.2.2";
+
+ describe(@"Test encoding data", ^{
+ context(@"with parameters", ^{
+ beforeEach(^{
+ testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:testAuthToken protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:testMake model:testModel trim:testTrim modelYear:testModelYear systemSoftwareVersion:testSystemSoftwareVersion systemHardwareVersion:testSystemHardwareVersion];
+ });
+
+ it(@"should create the correct data", ^{
+ NSString *base64Encoded = [testPayload.data base64EncodedStringWithOptions:0];
+ expect(base64Encoded).to(equal(@"bAEAAAR2aWRlb1NlcnZpY2VUcmFuc3BvcnRzABMAAAAQMAACAAAAEDEAAQAAAAAQaGFzaElkABk+FgACbW9kZWwAAwAAAElzABJtdHUAiVFbAAAAAAACbW9kZWxZZWFyAAUAAAAyMDIxAAJzeXN0ZW1IYXJkd2FyZVZlcnNpb24ACAAAADIuMi4yLjIAAm1ha2UABgAAAExpdmlvAAJhdXRoVG9rZW4AEAAAAFRlc3QgQXV0aCBUb2tlbgAEc2Vjb25kYXJ5VHJhbnNwb3J0cwAkAAAAAjAACQAAAFRDUF9XSUZJAAIxAAgAAABJQVBfVVNCAAACc3lzdGVtU29mdHdhcmVWZXJzaW9uAAgAAAAxLjEuMS4xAAJ0cmltAAgAAABBd2Vzb21lAARhdWRpb1NlcnZpY2VUcmFuc3BvcnRzAAwAAAAQMAACAAAAAAJwcm90b2NvbFZlcnNpb24ACAAAADEuMzIuMzIAAA=="));
+ });
});
- it(@"should create the correct data", ^{
- NSString *base64Encoded = [testPayload.data base64EncodedStringWithOptions:0];
- expect(base64Encoded).to(equal(@"OwAAABBoYXNoSWQAGT4WABJtdHUAiVFbAAAAAAACcHJvdG9jb2xWZXJzaW9uAAgAAAAxLjMyLjMyAAA="));
- });
- });
+ context(@"without parameters", ^{
+ beforeEach(^{
+ testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:SDLControlFrameInt32NotFound mtu:SDLControlFrameInt64NotFound authToken:nil protocolVersion:nil secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
+ });
- context(@"with secondary transport parameters", ^{
- beforeEach(^{
- testHashId = 987654;
- testMTU = 4096;
- testProtocolVersion = @"5.10.01";
- testSecondaryTransports = @[@"TCP_WIFI", @"IAP_USB"];
- testAudioServiceTransports = @[@(2)];
- testVideoServiceTransports = @[(@2), @(1)];
-
- testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
- });
-
- it(@"should create the correct data", ^{
- NSString *base64Encoded = [testPayload.data base64EncodedStringWithOptions:0];
- expect(base64Encoded).to(equal(@"wwAAAAR2aWRlb1NlcnZpY2VUcmFuc3BvcnRzABMAAAAQMAACAAAAEDEAAQAAAAAQaGFzaElkAAYSDwASbXR1AAAQAAAAAAAABHNlY29uZGFyeVRyYW5zcG9ydHMAJAAAAAIwAAkAAABUQ1BfV0lGSQACMQAIAAAASUFQX1VTQgAABGF1ZGlvU2VydmljZVRyYW5zcG9ydHMADAAAABAwAAIAAAAAAnByb3RvY29sVmVyc2lvbgAIAAAANS4xMC4wMQAA"));
+ it(@"should create no data", ^{
+ expect(testPayload.data.length).to(equal(0));
+ });
});
});
- context(@"without parameters", ^{
- beforeEach(^{
- testHashId = SDLControlFrameInt32NotFound;
- testMTU = SDLControlFrameInt64NotFound;
-
- testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:nil protocolVersion:nil secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
- });
-
- it(@"should create no data", ^{
- expect(testPayload.data.length).to(equal(0));
+ describe(@"Test decoding data", ^{
+ context(@"with parameters", ^{
+ beforeEach(^{
+ SDLControlFramePayloadRPCStartServiceAck *firstPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:testAuthToken protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:testMake model:testModel trim:testTrim modelYear:testModelYear systemSoftwareVersion:testSystemSoftwareVersion systemHardwareVersion:testSystemHardwareVersion];
+ testData = firstPayload.data;
+
+ testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData];
+ });
+
+ it(@"should output the correct params", ^{
+ expect(testPayload.hashId).to(equal(testHashId));
+ expect(testPayload.mtu).to(equal(testMTU));
+ expect(testPayload.authToken).to(equal(testAuthToken));
+ expect(testPayload.protocolVersion).to(equal(testProtocolVersion));
+ expect(testPayload.secondaryTransports).to(equal(testSecondaryTransports));
+ expect(testPayload.audioServiceTransports).to(equal(testAudioServiceTransports));
+ expect(testPayload.videoServiceTransports).to(equal(testVideoServiceTransports));
+ expect(testPayload.make).to(equal(testMake));
+ expect(testPayload.model).to(equal(testModel));
+ expect(testPayload.trim).to(equal(testTrim));
+ expect(testPayload.modelYear).to(equal(testModelYear));
+ expect(testPayload.systemSoftwareVersion).to(equal(testSystemSoftwareVersion));
+ expect(testPayload.systemHardwareVersion).to(equal(testSystemHardwareVersion));
+ });
});
});
-});
-
-describe(@"Test decoding data", ^{
- __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil;
- __block NSData *testData = nil;
- __block int32_t testHashId = 0;
- __block int64_t testMTU = 0;
- __block NSString *testAuthToken = nil;
- __block NSString *testProtocolVersion = nil;
- __block NSArray<NSString *> *testSecondaryTransports = nil;
- __block NSArray<NSNumber *> *testAudioServiceTransports = nil;
- __block NSArray<NSNumber *> *testVideoServiceTransports = nil;
-
- context(@"with parameters", ^{
- beforeEach(^{
- testHashId = 1545784;
- testMTU = 989786483;
- testAuthToken = @"testAuthToken";
- testProtocolVersion = @"3.89.5";
- SDLControlFramePayloadRPCStartServiceAck *firstPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:testAuthToken protocolVersion:testProtocolVersion secondaryTransports:nil audioServiceTransports:nil videoServiceTransports:nil];
- testData = firstPayload.data;
+ describe(@"Test nil data", ^{
+ __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil;
+ __block NSData *testData = nil;
- testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData];
- });
-
- it(@"should output the correct params", ^{
- expect(testPayload.hashId).to(equal(testHashId));
- expect(testPayload.mtu).to(equal(testMTU));
- expect(testPayload.authToken).to(equal(testAuthToken));
- expect(testPayload.protocolVersion).to(equal(testProtocolVersion));
- expect(testPayload.secondaryTransports).to(beNil());
- expect(testPayload.audioServiceTransports).to(beNil());
- expect(testPayload.videoServiceTransports).to(beNil());
- });
- });
-
- context(@"with secondary transport parameters", ^{
beforeEach(^{
- testHashId = 17999024;
- testMTU = 1798250;
- testAuthToken = @"testAuthToken";
- testProtocolVersion = @"6.01.00";
- testSecondaryTransports = @[@"TCP_WIFI"];
- testAudioServiceTransports = @[@(2), @(1)];
- testVideoServiceTransports = @[@(1)];
-
- SDLControlFramePayloadRPCStartServiceAck *firstPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMTU authToken:testAuthToken protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
- testData = firstPayload.data;
-
testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData];
});
it(@"should output the correct params", ^{
- expect(testPayload.hashId).to(equal(testHashId));
- expect(testPayload.mtu).to(equal(testMTU));
- expect(testPayload.authToken).to(equal(testAuthToken));
- expect(testPayload.protocolVersion).to(equal(testProtocolVersion));
- expect(testPayload.secondaryTransports).to(equal(testSecondaryTransports));
- expect(testPayload.audioServiceTransports).to(equal(testAudioServiceTransports));
- expect(testPayload.videoServiceTransports).to(equal(testVideoServiceTransports));
+ expect(testPayload.data.length).to(equal(0));
});
});
});
-describe(@"Test nil data", ^{
- __block SDLControlFramePayloadRPCStartServiceAck *testPayload = nil;
- __block NSData *testData = nil;
-
- beforeEach(^{
- testPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithData:testData];
- });
-
- it(@"should output the correct params", ^{
- expect(testPayload.data.length).to(equal(0));
- });
-});
-
QuickSpecEnd
diff --git a/SmartDeviceLinkTests/ProxySpecs/SDLSecondaryTransportManagerSpec.m b/SmartDeviceLinkTests/ProxySpecs/SDLSecondaryTransportManagerSpec.m
index b7279a352..41db3cdad 100644
--- a/SmartDeviceLinkTests/ProxySpecs/SDLSecondaryTransportManagerSpec.m
+++ b/SmartDeviceLinkTests/ProxySpecs/SDLSecondaryTransportManagerSpec.m
@@ -248,7 +248,7 @@ describe(@"the secondary transport manager ", ^{
testAudioServiceTransports = @[@(2), @(1)];
testVideoServiceTransports = @[@(2)];
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
});
@@ -274,7 +274,7 @@ describe(@"the secondary transport manager ", ^{
// Note: this is not allowed for now. It should contain only one element.
testSecondaryTransports = @[@"TCP_WIFI", @"IAP_USB_HOST_MODE"];
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
});
@@ -299,7 +299,7 @@ describe(@"the secondary transport manager ", ^{
testAudioServiceTransports = @[@(2)];
testVideoServiceTransports = @[@(2)];
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
});
@@ -320,7 +320,7 @@ describe(@"the secondary transport manager ", ^{
context(@"without secondary transport related parameter", ^{
beforeEach(^{
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
});
@@ -411,7 +411,7 @@ describe(@"the secondary transport manager ", ^{
testTransportEventUpdatePayload = [[SDLControlFramePayloadTransportEventUpdate alloc] initWithTcpIpAddress:testTcpIpAddress tcpPort:testTcpPort];
testTransportEventUpdateMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testTransportEventUpdateHeader andPayload:testTransportEventUpdatePayload.data];
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
manager.currentHMILevel = SDLHMILevelFull;
manager.currentApplicationState = UIApplicationStateActive;
@@ -450,7 +450,7 @@ describe(@"the secondary transport manager ", ^{
testTransportEventUpdatePayload = [[SDLControlFramePayloadTransportEventUpdate alloc] initWithTcpIpAddress:testTcpIpAddress tcpPort:testTcpPort];
testTransportEventUpdateMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testTransportEventUpdateHeader andPayload:testTransportEventUpdatePayload.data];
- testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports];
+ testStartServiceACKPayload = [[SDLControlFramePayloadRPCStartServiceAck alloc] initWithHashId:testHashId mtu:testMtu authToken:nil protocolVersion:testProtocolVersion secondaryTransports:testSecondaryTransports audioServiceTransports:testAudioServiceTransports videoServiceTransports:testVideoServiceTransports make:nil model:nil trim:nil modelYear:nil systemSoftwareVersion:nil systemHardwareVersion:nil];
testStartServiceACKMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testStartServiceACKHeader andPayload:testStartServiceACKPayload.data];
});
diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
index 1b00938fb..3ad17cb87 100644
--- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
@@ -39,18 +39,18 @@ describe(@"Getter/Setter Tests", ^ {
testResponse.buttonCapabilities = @[button];
testResponse.softButtonCapabilities = @[softButton];
testResponse.presetBankCapabilities = presetBank;
+ testResponse.vehicleType = vehicle;
+ testResponse.systemSoftwareVersion = @"systemSoftwareVersion";
#pragma clang diagnostic pop
testResponse.hmiZoneCapabilities = @[SDLHMIZoneCapabilitiesBack, SDLHMIZoneCapabilitiesFront];
testResponse.speechCapabilities = @[SDLSpeechCapabilitiesSAPIPhonemes, SDLSpeechCapabilitiesSilence];
testResponse.vrCapabilities = @[SDLVRCapabilitiesText];
testResponse.audioPassThruCapabilities = @[audioPassThru];
testResponse.pcmStreamCapabilities = audioPassThru;
- testResponse.vehicleType = vehicle;
testResponse.prerecordedSpeech = @[SDLPrerecordedSpeechListen, SDLPrerecordedSpeechHelp];
testResponse.supportedDiagModes = @[@67, @99, @111];
testResponse.hmiCapabilities = hmiCapabilities;
testResponse.sdlVersion = @"sdlVersion";
- testResponse.systemSoftwareVersion = @"systemSoftwareVersion";
testResponse.iconResumed = @YES;
testResponse.sdlMsgVersion = sdlVersion;
@@ -63,18 +63,18 @@ describe(@"Getter/Setter Tests", ^ {
expect(testResponse.buttonCapabilities).to(equal(@[button]));
expect(testResponse.softButtonCapabilities).to(equal(@[softButton]));
expect(testResponse.presetBankCapabilities).to(equal(presetBank));
+ expect(testResponse.vehicleType).to(equal(vehicle));
+ expect(testResponse.systemSoftwareVersion).to(equal(@"systemSoftwareVersion"));
#pragma clang diagnostic pop
expect(testResponse.hmiZoneCapabilities).to(equal(@[SDLHMIZoneCapabilitiesBack, SDLHMIZoneCapabilitiesFront]));
expect(testResponse.speechCapabilities).to(equal(@[SDLSpeechCapabilitiesSAPIPhonemes, SDLSpeechCapabilitiesSilence]));
expect(testResponse.vrCapabilities).to(equal(@[SDLVRCapabilitiesText]));
expect(testResponse.audioPassThruCapabilities).to(equal(@[audioPassThru]));
expect(testResponse.pcmStreamCapabilities).to(equal(audioPassThru));
- expect(testResponse.vehicleType).to(equal(vehicle));
expect(testResponse.prerecordedSpeech).to(equal(@[SDLPrerecordedSpeechListen, SDLPrerecordedSpeechHelp]));
expect(testResponse.supportedDiagModes).to(equal(@[@67, @99, @111]));
expect(testResponse.hmiCapabilities).to(equal(hmiCapabilities));
expect(testResponse.sdlVersion).to(equal(@"sdlVersion"));
- expect(testResponse.systemSoftwareVersion).to(equal(@"systemSoftwareVersion"));
expect(testResponse.iconResumed).to(beTrue());
});
@@ -118,18 +118,18 @@ describe(@"Getter/Setter Tests", ^ {
expect(testResponse.buttonCapabilities).to(equal(@[button]));
expect(testResponse.softButtonCapabilities).to(equal(@[softButton]));
expect(testResponse.presetBankCapabilities).to(equal(presetBank));
+ expect(testResponse.vehicleType).to(equal(vehicle));
+ expect(testResponse.systemSoftwareVersion).to(equal(@"systemSoftwareVersion"));
#pragma clang diagnostic pop
expect(testResponse.hmiZoneCapabilities).to(equal(@[SDLHMIZoneCapabilitiesBack, SDLHMIZoneCapabilitiesFront]));
expect(testResponse.speechCapabilities).to(equal(@[SDLSpeechCapabilitiesSAPIPhonemes, SDLSpeechCapabilitiesSilence]));
expect(testResponse.vrCapabilities).to(equal(@[SDLVRCapabilitiesText]));
expect(testResponse.audioPassThruCapabilities).to(equal(@[audioPassThru]));
expect(testResponse.pcmStreamCapabilities).to(equal(audioPassThru));
- expect(testResponse.vehicleType).to(equal(vehicle));
expect(testResponse.prerecordedSpeech).to(equal(@[SDLPrerecordedSpeechListen, SDLPrerecordedSpeechHelp]));
expect(testResponse.supportedDiagModes).to(equal(@[@67, @99, @111]));
expect(testResponse.hmiCapabilities).to(equal(hmiCapabilities));
expect(testResponse.sdlVersion).to(equal(@"sdlVersion"));
- expect(testResponse.systemSoftwareVersion).to(equal(@"systemSoftwareVersion"));
expect(testResponse.iconResumed).to(beTrue());
});
@@ -147,18 +147,18 @@ describe(@"Getter/Setter Tests", ^ {
expect(testResponse.buttonCapabilities).to(beNil());
expect(testResponse.softButtonCapabilities).to(beNil());
expect(testResponse.presetBankCapabilities).to(beNil());
+ expect(testResponse.vehicleType).to(beNil());
+ expect(testResponse.systemSoftwareVersion).to(beNil());
#pragma clang diagnostic pop
expect(testResponse.hmiZoneCapabilities).to(beNil());
expect(testResponse.speechCapabilities).to(beNil());
expect(testResponse.vrCapabilities).to(beNil());
expect(testResponse.audioPassThruCapabilities).to(beNil());
expect(testResponse.pcmStreamCapabilities).to(beNil());
- expect(testResponse.vehicleType).to(beNil());
expect(testResponse.prerecordedSpeech).to(beNil());
expect(testResponse.supportedDiagModes).to(beNil());
expect(testResponse.hmiCapabilities).to(beNil());
expect(testResponse.sdlVersion).to(beNil());
- expect(testResponse.systemSoftwareVersion).to(beNil());
expect(testResponse.iconResumed).to(beNil());
});
@@ -197,18 +197,18 @@ describe(@"Getter/Setter Tests", ^ {
expectAction(^{ [testResponse buttonCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse softButtonCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse presetBankCapabilities]; }).to(raiseException());
+ expectAction(^{ [testResponse vehicleType]; }).to(raiseException());
+ expectAction(^{ [testResponse systemSoftwareVersion]; }).to(raiseException());
#pragma clang diagnostic pop
expectAction(^{ [testResponse hmiZoneCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse speechCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse vrCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse audioPassThruCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse pcmStreamCapabilities]; }).to(raiseException());
- expectAction(^{ [testResponse vehicleType]; }).to(raiseException());
expectAction(^{ [testResponse prerecordedSpeech]; }).to(raiseException());
expectAction(^{ [testResponse supportedDiagModes]; }).to(raiseException());
expectAction(^{ [testResponse hmiCapabilities]; }).to(raiseException());
expectAction(^{ [testResponse sdlVersion]; }).to(raiseException());
- expectAction(^{ [testResponse systemSoftwareVersion]; }).to(raiseException());
expectAction(^{ [testResponse iconResumed]; }).to(raiseException());
});
});
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m
index a4f3efa0d..207667dd5 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVehicleTypeSpec.m
@@ -14,41 +14,57 @@
QuickSpecBegin(SDLVehicleTypeSpec)
describe(@"Getter/Setter Tests", ^ {
+ NSString *make = @"make";
+ NSString *model = @"model";
+ NSString *modelYear = @"modelYear";
+ NSString *trim = @"trim";
+
it(@"Should set and get correctly", ^ {
- SDLVehicleType* testStruct = [[SDLVehicleType alloc] init];
+ SDLVehicleType *testStruct = [[SDLVehicleType alloc] init];
- testStruct.make = @"Make";
- testStruct.model = @"Model";
- testStruct.modelYear = @"3.141*10^36";
- testStruct.trim = @"AE";
+ testStruct.make = make;
+ testStruct.model = model;
+ testStruct.modelYear = modelYear;
+ testStruct.trim = trim;
- expect(testStruct.make).to(equal(@"Make"));
- expect(testStruct.model).to(equal(@"Model"));
- expect(testStruct.modelYear).to(equal(@"3.141*10^36"));
- expect(testStruct.trim).to(equal(@"AE"));
+ expect(testStruct.make).to(equal(make));
+ expect(testStruct.model).to(equal(model));
+ expect(testStruct.modelYear).to(equal(modelYear));
+ expect(testStruct.trim).to(equal(trim));
});
- it(@"Should get correctly when initialized", ^ {
- NSMutableDictionary<NSString *, id> *dict = [@{SDLRPCParameterNameMake:@"Make",
- SDLRPCParameterNameModel:@"Model",
- SDLRPCParameterNameModelYear:@"3.141*10^36",
- SDLRPCParameterNameTrim:@"AE"} mutableCopy];
- SDLVehicleType* testStruct = [[SDLVehicleType alloc] initWithDictionary:dict];
+ it(@"Should get correctly when initialized with a dictionary", ^ {
+ NSDictionary *dict = @{
+ SDLRPCParameterNameMake: make,
+ SDLRPCParameterNameModel: model,
+ SDLRPCParameterNameModelYear: modelYear,
+ SDLRPCParameterNameTrim: trim
+ };
+ SDLVehicleType *testStruct = [[SDLVehicleType alloc] initWithDictionary:dict];
- expect(testStruct.make).to(equal(@"Make"));
- expect(testStruct.model).to(equal(@"Model"));
- expect(testStruct.modelYear).to(equal(@"3.141*10^36"));
- expect(testStruct.trim).to(equal(@"AE"));
+ expect(testStruct.make).to(equal(make));
+ expect(testStruct.model).to(equal(model));
+ expect(testStruct.modelYear).to(equal(modelYear));
+ expect(testStruct.trim).to(equal(trim));
});
- it(@"Should return nil if not set", ^ {
- SDLVehicleType* testStruct = [[SDLVehicleType alloc] init];
+ it(@"should initialize correctly with init", ^ {
+ SDLVehicleType *testStruct = [[SDLVehicleType alloc] init];
expect(testStruct.make).to(beNil());
expect(testStruct.model).to(beNil());
expect(testStruct.modelYear).to(beNil());
expect(testStruct.trim).to(beNil());
});
+
+ it(@"should initialize correctly with initWithMake:model:modelYear:trim:", ^{
+ SDLVehicleType *testStruct = [[SDLVehicleType alloc] initWithMake:make model:model modelYear:modelYear trim:trim];
+
+ expect(testStruct.make).to(equal(make));
+ expect(testStruct.model).to(equal(model));
+ expect(testStruct.modelYear).to(equal(modelYear));
+ expect(testStruct.trim).to(equal(trim));
+ });
});
QuickSpecEnd
diff --git a/SmartDeviceLinkTests/SDLEncryptionLifecycleManagerSpec.m b/SmartDeviceLinkTests/SDLEncryptionLifecycleManagerSpec.m
index 15295118b..d1559b136 100644
--- a/SmartDeviceLinkTests/SDLEncryptionLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/SDLEncryptionLifecycleManagerSpec.m
@@ -45,6 +45,7 @@ describe(@"the encryption lifecycle manager", ^{
beforeEach(^{
testConnectionManager = [[TestConnectionManager alloc] init];
+ testConnectionManager.systemInfo = [[SDLSystemInfo alloc] initWithMake:@"Make" model:@"Model" trim:@"Trim" modelYear:@"Model Year" softwareVersion:@"1.1.1.1" hardwareVersion:@"2.2.2.2"];
testFakeSecurityManager = [[SDLFakeSecurityManager alloc] init];
SDLEncryptionConfiguration *encryptionConfig = [[SDLEncryptionConfiguration alloc] initWithSecurityManagers:@[testFakeSecurityManager.class] delegate:nil];
@@ -63,122 +64,123 @@ describe(@"the encryption lifecycle manager", ^{
describe(@"when started", ^{
__block BOOL readyHandlerSuccess = NO;
__block NSError *readyHandlerError = nil;
-
__block SDLProtocol *protocolMock = OCMClassMock([SDLProtocol class]);
-
- beforeEach(^{
- readyHandlerSuccess = NO;
- readyHandlerError = nil;
-
- [encryptionLifecycleManager startWithProtocol:protocolMock];
- });
-
- it(@"should not be ready to encrypt", ^{
- expect(encryptionLifecycleManager.isEncryptionReady).to(beFalse());
- });
-
- describe(@"after receiving an RPC Start ACK", ^{
- __block SDLProtocolHeader *testRPCHeader = nil;
- __block SDLProtocolMessage *testRPCMessage = nil;
-
- beforeEach(^{
- [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStarting fromOldState:nil callEnterTransition:YES];
-
- testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testRPCHeader.frameType = SDLFrameTypeSingle;
- testRPCHeader.frameData = SDLFrameInfoStartServiceACK;
- testRPCHeader.encrypted = YES;
- testRPCHeader.serviceType = SDLServiceTypeRPC;
-
- testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
- [encryptionLifecycleManager protocol:protocolMock didReceiveStartServiceACK:testRPCMessage];
- });
-
- it(@"should have set all the right properties", ^{
- expect(encryptionLifecycleManager.isEncryptionReady).to(equal(YES));
- expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateReady));
- });
- });
-
- describe(@"after receiving an RPC Start NAK", ^{
- __block SDLProtocolHeader *testRPCHeader = nil;
- __block SDLProtocolMessage *testRPCMessage = nil;
-
+
+ context(@"when system info doesn't match", ^{
beforeEach(^{
- [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStarting fromOldState:nil callEnterTransition:NO];
-
- testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testRPCHeader.frameType = SDLFrameTypeSingle;
- testRPCHeader.frameData = SDLFrameInfoStartServiceNACK;
- testRPCHeader.encrypted = NO;
- testRPCHeader.serviceType = SDLServiceTypeRPC;
-
- testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
- [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceACK:testRPCMessage];
+ readyHandlerSuccess = NO;
+ readyHandlerError = nil;
+
+ [encryptionLifecycleManager startWithProtocol:protocolMock];
});
-
- it(@"should have set all the right properties", ^{
- expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+
+ it(@"should not be ready to encrypt", ^{
+ OCMVerify([protocolMock setSecurityManager:[OCMArg isNil]]);
+ expect(encryptionLifecycleManager.isEncryptionReady).to(beFalse());
});
});
-
- describe(@"after receiving a RPC end ACK", ^{
- __block SDLProtocolHeader *testRPCHeader = nil;
- __block SDLProtocolMessage *testRPCMessage = nil;
-
+
+ context(@"when security managers are available", ^{
beforeEach(^{
- [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStopped fromOldState:nil callEnterTransition:NO];
-
- testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testRPCHeader.frameType = SDLFrameTypeSingle;
- testRPCHeader.frameData = SDLFrameInfoEndServiceACK;
- testRPCHeader.encrypted = NO;
- testRPCHeader.serviceType = SDLServiceTypeRPC;
-
- testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
- [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceACK:testRPCMessage];
+ testConnectionManager.systemInfo.vehicleType.make = @"SDL";
+ readyHandlerSuccess = NO;
+ readyHandlerError = nil;
+
+ [encryptionLifecycleManager startWithProtocol:protocolMock];
});
-
- it(@"should have set all the right properties", ^{
- expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+
+ it(@"should not be ready to encrypt", ^{
+ OCMVerify([protocolMock setSecurityManager:[OCMArg isNotNil]]);
+ expect(encryptionLifecycleManager.isEncryptionReady).to(beFalse());
});
- });
-
- describe(@"after receiving a RPC end NAK", ^{
- __block SDLProtocolHeader *testRPCHeader = nil;
- __block SDLProtocolMessage *testRPCMessage = nil;
-
- beforeEach(^{
- [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStopped fromOldState:nil callEnterTransition:NO];
-
- testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
- testRPCHeader.frameType = SDLFrameTypeSingle;
- testRPCHeader.frameData = SDLFrameInfoEndServiceNACK;
- testRPCHeader.encrypted = NO;
- testRPCHeader.serviceType = SDLServiceTypeRPC;
-
- testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
- [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceNAK:testRPCMessage];
+
+ describe(@"after receiving an RPC Start ACK", ^{
+ __block SDLProtocolHeader *testRPCHeader = nil;
+ __block SDLProtocolMessage *testRPCMessage = nil;
+
+ beforeEach(^{
+ [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStarting fromOldState:nil callEnterTransition:YES];
+
+ testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
+ testRPCHeader.frameType = SDLFrameTypeSingle;
+ testRPCHeader.frameData = SDLFrameInfoStartServiceACK;
+ testRPCHeader.encrypted = YES;
+ testRPCHeader.serviceType = SDLServiceTypeRPC;
+
+ testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
+ [encryptionLifecycleManager protocol:protocolMock didReceiveStartServiceACK:testRPCMessage];
+ });
+
+ it(@"should have set all the right properties", ^{
+ expect(encryptionLifecycleManager.isEncryptionReady).to(equal(YES));
+ expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateReady));
+ });
});
-
- it(@"should have set all the right properties", ^{
- expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+
+ describe(@"after receiving an RPC Start NAK", ^{
+ __block SDLProtocolHeader *testRPCHeader = nil;
+ __block SDLProtocolMessage *testRPCMessage = nil;
+
+ beforeEach(^{
+ [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStarting fromOldState:nil callEnterTransition:NO];
+
+ testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
+ testRPCHeader.frameType = SDLFrameTypeSingle;
+ testRPCHeader.frameData = SDLFrameInfoStartServiceNACK;
+ testRPCHeader.encrypted = NO;
+ testRPCHeader.serviceType = SDLServiceTypeRPC;
+
+ testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
+ [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceACK:testRPCMessage];
+ });
+
+ it(@"should have set all the right properties", ^{
+ expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+ });
});
- });
- describe(@"when a register app interface response is received", ^{
- beforeEach(^{
- OCMExpect([protocolMock setSecurityManager:[OCMArg any]]);
+ describe(@"after receiving a RPC end ACK", ^{
+ __block SDLProtocolHeader *testRPCHeader = nil;
+ __block SDLProtocolMessage *testRPCMessage = nil;
+
+ beforeEach(^{
+ [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStopped fromOldState:nil callEnterTransition:NO];
+
+ testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
+ testRPCHeader.frameType = SDLFrameTypeSingle;
+ testRPCHeader.frameData = SDLFrameInfoEndServiceACK;
+ testRPCHeader.encrypted = NO;
+ testRPCHeader.serviceType = SDLServiceTypeRPC;
- SDLRegisterAppInterfaceResponse *rair = [[SDLRegisterAppInterfaceResponse alloc] init];
- rair.vehicleType = [[SDLVehicleType alloc] init];
- rair.vehicleType.make = @"SDL";
- SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:nil rpcResponse:rair];
- [[NSNotificationCenter defaultCenter] postNotification:notification];
+ testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
+ [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceACK:testRPCMessage];
+ });
+
+ it(@"should have set all the right properties", ^{
+ expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+ });
});
- it(@"should set the protocol's security manager", ^{
- OCMVerifyAll((id)protocolMock);
+ describe(@"after receiving a RPC end NAK", ^{
+ __block SDLProtocolHeader *testRPCHeader = nil;
+ __block SDLProtocolMessage *testRPCMessage = nil;
+
+ beforeEach(^{
+ [encryptionLifecycleManager.encryptionStateMachine setToState:SDLEncryptionLifecycleManagerStateStopped fromOldState:nil callEnterTransition:NO];
+
+ testRPCHeader = [[SDLV2ProtocolHeader alloc] initWithVersion:5];
+ testRPCHeader.frameType = SDLFrameTypeSingle;
+ testRPCHeader.frameData = SDLFrameInfoEndServiceNACK;
+ testRPCHeader.encrypted = NO;
+ testRPCHeader.serviceType = SDLServiceTypeRPC;
+
+ testRPCMessage = [[SDLV2ProtocolMessage alloc] initWithHeader:testRPCHeader andPayload:nil];
+ [encryptionLifecycleManager protocol:protocolMock didReceiveEndServiceNAK:testRPCMessage];
+ });
+
+ it(@"should have set all the right properties", ^{
+ expect(encryptionLifecycleManager.encryptionStateMachine.currentState).to(equal(SDLEncryptionLifecycleManagerStateStopped));
+ });
});
});
});
diff --git a/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.h b/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.h
index d3dd50a19..3f91c72ba 100644
--- a/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.h
+++ b/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.h
@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface TestConnectionManager : NSObject <SDLConnectionManagerType>
+@property (strong, nonatomic, nullable) SDLSystemInfo *systemInfo;
+
@property (copy, nonatomic, readonly) NSError *defaultError;
/**
diff --git a/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.m b/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.m
index 4774f8d09..525ad3052 100644
--- a/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.m
+++ b/SmartDeviceLinkTests/TestUtilities/TestConnectionManager.m
@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
_receivedRequestObjects = [NSMutableArray<TestConnectionRequestObject *> array];
_multipleCompletionBlocks = [NSMutableArray array];
+ _systemInfo = [[SDLSystemInfo alloc] initWithMake:@"Livio" model:@"Is" trim:@"Awesome" modelYear:@"2021" softwareVersion:@"1.1.1.1" hardwareVersion:@"2.2.2.2"];
return self;
}