diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-02-25 16:10:20 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-02-25 16:10:20 -0500 |
commit | 54cb8a68010abd244b8251f9dcfb1c8f326610c0 (patch) | |
tree | a8de4dcfa91305fe799e62b89a2714bb9014abb6 | |
parent | b4c8806c92ad7abff0b03be61485a09cf3520350 (diff) | |
parent | c9db35d11bc18c8f7a341f0f4231a381f9e3be2e (diff) | |
download | sdl_ios-54cb8a68010abd244b8251f9dcfb1c8f326610c0.tar.gz |
Merge branch 'develop' into feature/issue-1876-sdl-0293-enable-oem-exclusive-app-support
# Conflicts:
# SmartDeviceLink-iOS.xcodeproj/project.pbxproj
39 files changed, 1242 insertions, 170 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 048cb58c6..440bf0dcb 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -1690,6 +1690,15 @@ 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, ); }; }; + B3A9D9ED25D2586C00CDFD21 /* SDLKeyboardInputMask.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9EB25D2586C00CDFD21 /* SDLKeyboardInputMask.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B3A9D9EE25D2586C00CDFD21 /* SDLKeyboardInputMask.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9D9EC25D2586C00CDFD21 /* SDLKeyboardInputMask.m */; }; + B3A9DA0425D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */; }; + B3A9DA0A25D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */; }; + B3A9DA1225D270EA00CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */; }; B3EC9E6E2579AA010039F3AA /* SDLClimateDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */; }; B3F7918324E062C200DB5CAF /* SDLGetVehicleDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 162E824C1A9BDE8A00906325 /* SDLGetVehicleDataSpec.m */; }; C975877F257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = C975877E257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m */; }; @@ -3545,6 +3554,15 @@ B38D8E7D24A118BD00B977D0 /* SDLGearStatusSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLGearStatusSpec.m; sourceTree = "<group>"; }; B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLTransmissionTypeSpec.m; sourceTree = "<group>"; }; B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLCapacityUnitSpec.m; sourceTree = "<group>"; }; + B3A9D9DF25D2571000CDFD21 /* SDLKeyboardCapabilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLKeyboardCapabilities.m; path = public/SDLKeyboardCapabilities.m; sourceTree = "<group>"; }; + B3A9D9E025D2571000CDFD21 /* SDLKeyboardCapabilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLKeyboardCapabilities.h; path = public/SDLKeyboardCapabilities.h; sourceTree = "<group>"; }; + B3A9D9E525D2578F00CDFD21 /* SDLKeyboardLayoutCapability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLKeyboardLayoutCapability.m; path = public/SDLKeyboardLayoutCapability.m; sourceTree = "<group>"; }; + B3A9D9E625D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLKeyboardLayoutCapability.h; path = public/SDLKeyboardLayoutCapability.h; sourceTree = "<group>"; }; + B3A9D9EB25D2586C00CDFD21 /* SDLKeyboardInputMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLKeyboardInputMask.h; path = public/SDLKeyboardInputMask.h; sourceTree = "<group>"; }; + B3A9D9EC25D2586C00CDFD21 /* SDLKeyboardInputMask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLKeyboardInputMask.m; path = public/SDLKeyboardInputMask.m; sourceTree = "<group>"; }; + B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardInputMaskSpec.m; sourceTree = "<group>"; }; + B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardCapabilitiesSpec.m; sourceTree = "<group>"; }; + B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLKeyboardLayoutCapabilitySpec.m; sourceTree = "<group>"; }; B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLClimateDataSpec.m; sourceTree = "<group>"; }; BB3C600D221AEF37007DD4CA /* NSMutableDictionary+StoreSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSMutableDictionary+StoreSpec.m"; path = "DevAPISpecs/NSMutableDictionary+StoreSpec.m"; sourceTree = "<group>"; }; C975877E257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSeekIndicatorTypeSpec.m; sourceTree = "<group>"; }; @@ -3761,6 +3779,7 @@ 162E81FD1A9BDE8A00906325 /* SDLImageTypeSpec.m */, 162E81FE1A9BDE8A00906325 /* SDLInteractionModeSpec.m */, 162E81FF1A9BDE8A00906325 /* SDLKeyboardEventSpec.m */, + B3A9DA0325D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m */, 162E82001A9BDE8A00906325 /* SDLKeyboardLayoutSpec.m */, 162E82011A9BDE8A00906325 /* SDLKeypressModeSpec.m */, 162E82021A9BDE8A00906325 /* SDLLanguageSpec.m */, @@ -4033,6 +4052,7 @@ B3EC9E6D2579AA010039F3AA /* SDLClimateDataSpec.m */, 885468372225CBA400994D8D /* SDLCloudAppPropertiesSpec.m */, 162E82951A9BDE8A00906325 /* SDLClusterModeStatusSpec.m */, + B3992641258FAADF0048F09B /* SDLConfigurableKeyboardsSpec.m */, DA9F7EB31DCC086400ACAE48 /* SDLDateTimeSpec.m */, 162E82961A9BDE8A00906325 /* SDLDeviceInfoSpec.m */, 162E82971A9BDE8A00906325 /* SDLDeviceStatusSpec.m */, @@ -4057,6 +4077,8 @@ 162E829F1A9BDE8A00906325 /* SDLImageFieldSpec.m */, 5DB202261F5F2D030061D189 /* SDLImageResolutionSpec.m */, 162E82A01A9BDE8A00906325 /* SDLImageSpec.m */, + B3A9DA0925D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m */, + B3A9DA1125D270E900CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m */, 162E82A11A9BDE8A00906325 /* SDLKeyboardPropertiesSpec.m */, 1EAA476B2036A52F000FE74B /* SDLLightCapabilitiesSpec.m */, 1EAA476920369ECC000FE74B /* SDLLightControlCapabilitiesSpec.m */, @@ -5090,6 +5112,8 @@ 4ABB2B2124F84EF00061BF55 /* SDLCloudAppProperties.m */, 4ABB2B3224F84EF30061BF55 /* SDLClusterModeStatus.h */, 4ABB2B3024F84EF30061BF55 /* SDLClusterModeStatus.m */, + B3992632258C276B0048F09B /* SDLConfigurableKeyboards.h */, + B3992631258C276A0048F09B /* SDLConfigurableKeyboards.m */, 4ABB2B2D24F84EF20061BF55 /* SDLDateTime.h */, 4ABB2B2324F84EF00061BF55 /* SDLDateTime.m */, 4ABB2B1F24F84EF00061BF55 /* SDLDeviceInfo.h */, @@ -5142,6 +5166,12 @@ 4ABB2B9824F850AD0061BF55 /* SDLImageField.m */, 4ABB2B9B24F850AD0061BF55 /* SDLImageResolution.h */, 4ABB2B9124F850AC0061BF55 /* SDLImageResolution.m */, + B3A9D9E025D2571000CDFD21 /* SDLKeyboardCapabilities.h */, + B3A9D9DF25D2571000CDFD21 /* SDLKeyboardCapabilities.m */, + B3A9D9EB25D2586C00CDFD21 /* SDLKeyboardInputMask.h */, + B3A9D9EC25D2586C00CDFD21 /* SDLKeyboardInputMask.m */, + B3A9D9E625D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h */, + B3A9D9E525D2578F00CDFD21 /* SDLKeyboardLayoutCapability.m */, 4ABB2B9224F850AC0061BF55 /* SDLLightCapabilities.h */, 4ABB2B9624F850AD0061BF55 /* SDLLightCapabilities.m */, 4ABB2B8F24F850AB0061BF55 /* SDLLightControlCapabilities.h */, @@ -5150,6 +5180,8 @@ 4ABB2B9724F850AD0061BF55 /* SDLLightControlData.m */, 4ABB2B9424F850AC0061BF55 /* SDLLightState.h */, 4ABB2B9A24F850AD0061BF55 /* SDLLightState.m */, + B3992622258C1E480048F09B /* SDLKeyboardCapabilities.h */, + B3992621258C1E480048F09B /* SDLKeyboardCapabilities.m */, 4A8BD22724F93132000945E3 /* SDLKeyboardProperties.h */, 4A8BD23A24F93135000945E3 /* SDLKeyboardProperties.m */, 4A8BD22824F93132000945E3 /* SDLLocationCoordinate.h */, @@ -5381,6 +5413,8 @@ 4ABB278224F7FF090061BF55 /* SDLInteractionMode.m */, 4ABB278624F7FF0A0061BF55 /* SDLKeyboardEvent.h */, 4ABB277E24F7FF090061BF55 /* SDLKeyboardEvent.m */, + B3992627258C24120048F09B /* SDLKeyboardInputMask.h */, + B3992628258C24130048F09B /* SDLKeyboardInputMask.m */, 4ABB278B24F7FF0B0061BF55 /* SDLKeyboardLayout.h */, 4ABB277F24F7FF090061BF55 /* SDLKeyboardLayout.m */, 4ABB278824F7FF0A0061BF55 /* SDLKeypressMode.h */, @@ -7014,6 +7048,7 @@ 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 */, @@ -7037,6 +7072,7 @@ 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 */, @@ -7260,6 +7296,7 @@ 4ABB275224F7FD9C0061BF55 /* SDLFuelCutoffStatus.h in Headers */, 4ABB24BE24F592620061BF55 /* NSBundle+SDLBundle.h in Headers */, 4ABB286124F828E00061BF55 /* SDLVehicleDataResultCode.h in Headers */, + B3A9D9E825D2578F00CDFD21 /* SDLKeyboardLayoutCapability.h in Headers */, 4ABB2BA024F850AE0061BF55 /* SDLLightCapabilities.h in Headers */, 4ABB284124F828630061BF55 /* SDLTurnSignal.h in Headers */, 4ABB299D24F845440061BF55 /* SDLScrollableMessage.h in Headers */, @@ -7274,6 +7311,7 @@ 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 */, @@ -7327,6 +7365,7 @@ 4ABB26D724F7FAFD0061BF55 /* SDLRPCMessage.h in Headers */, 4A8BD24A24F93135000945E3 /* SDLMyKey.h in Headers */, 4ABB24F924F5959E0061BF55 /* SDLAsynchronousOperation.h in Headers */, + B3A9D9E225D2571000CDFD21 /* SDLKeyboardCapabilities.h in Headers */, 4ABB29B324F845DB0061BF55 /* SDLShow.h in Headers */, 4ABB25B424F7E6F60061BF55 /* SDLSoftButtonReplaceOperation.h in Headers */, 4ABB269C24F7F9710061BF55 /* SDLRPCParameterNames.h in Headers */, @@ -7460,6 +7499,7 @@ 4A8BD36E24F94636000945E3 /* SDLProtocolMessageAssembler.h in Headers */, 4ABB28C024F82A6A0061BF55 /* SDLOnCommand.h in Headers */, 4ABB26A824F7F9CF0061BF55 /* SDLLogTargetAppleSystemLog.h in Headers */, + B3A9D9ED25D2586C00CDFD21 /* SDLKeyboardInputMask.h in Headers */, 4ABB250524F596450061BF55 /* SDLListFilesOperation.h in Headers */, 4ABB268F24F7F8FC0061BF55 /* SDLHexUtility.h in Headers */, 4A8BD28124F9343F000945E3 /* SDLRemoteControlCapabilities.h in Headers */, @@ -7849,6 +7889,7 @@ 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 */, @@ -7861,6 +7902,7 @@ 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 */, @@ -8089,6 +8131,7 @@ 4ABB269224F7F9060061BF55 /* SDLTimer.m in Sources */, 4ABB25C624F7E73C0061BF55 /* SDLSubscribeButtonManager.m in Sources */, 4ABB278E24F7FF0B0061BF55 /* SDLKeyboardEvent.m in Sources */, + B3A9D9E725D2578F00CDFD21 /* SDLKeyboardLayoutCapability.m in Sources */, 4ABB279024F7FF0B0061BF55 /* SDLImageType.m in Sources */, 4ABB28CB24F82A6A0061BF55 /* SDLOnTouchEvent.m in Sources */, 4ABB2B4E24F84EF50061BF55 /* SDLClusterModeStatus.m in Sources */, @@ -8151,6 +8194,7 @@ 4ABB2AB924F847F40061BF55 /* SDLSetInteriorVehicleDataResponse.m in Sources */, 4ABB295424F843440061BF55 /* SDLEndAudioPassThru.m in Sources */, 4ABB2A2924F847980061BF55 /* SDLDeleteFileResponse.m in Sources */, + B3A9D9EE25D2586C00CDFD21 /* SDLKeyboardInputMask.m in Sources */, 4ABB284524F828630061BF55 /* SDLTouchType.m in Sources */, 4ABB2B8024F8504A0061BF55 /* SDLHapticRect.m in Sources */, 4A8BD38A24F94712000945E3 /* SDLSecondaryTransportManager.m in Sources */, @@ -8181,6 +8225,7 @@ 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 */, @@ -8391,6 +8436,7 @@ 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 */, @@ -8429,6 +8475,7 @@ 162E837D1A9BDE8B00906325 /* SDLEmergencyEventSpec.m in Sources */, 162E82D31A9BDE8A00906325 /* SDLCarModeStatusSpec.m in Sources */, 8B7B31A91F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m in Sources */, + B3A9DA0A25D26E1800CDFD21 /* SDLKeyboardCapabilitiesSpec.m in Sources */, 88EED83B1F33BECB00E6C42E /* SDLHapticRectSpec.m in Sources */, 162E82EA1A9BDE8B00906325 /* SDLLanguageSpec.m in Sources */, 5D76E3291D3D0A8800647CFA /* SDLFakeViewControllerPresenter.m in Sources */, @@ -8504,6 +8551,7 @@ 162E835B1A9BDE8B00906325 /* SDLPerformInteractionResponseSpec.m in Sources */, 880E35B82088F78E00181259 /* SDLSystemCapabilityManagerSpec.m in Sources */, 162E832D1A9BDE8B00906325 /* SDLEncodedSyncPDataSpec.m in Sources */, + B3A9DA0425D26D8500CDFD21 /* SDLKeyboardInputMaskSpec.m in Sources */, 1EE8C44C1F385C7100FDC2CF /* SDLRDSDataSpec.m in Sources */, 5DB92D241AC47B2C00C15BB0 /* SDLHexUtilitySpec.m in Sources */, 8815D0F022330765000F24E6 /* SDLRPCRequestNotificationSpec.m in Sources */, @@ -8676,6 +8724,7 @@ 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 */, @@ -8685,6 +8734,7 @@ 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 */, @@ -8808,6 +8858,7 @@ 162E830F1A9BDE8B00906325 /* SDLOnAppInterfaceUnregisteredSpec.m in Sources */, 162E83971A9BDE8B00906325 /* SDLVehicleTypeSpec.m in Sources */, 887BE4D422272B2200B397C2 /* SDLControlFramePayloadConstantsSpec.m in Sources */, + B3A9DA1225D270EA00CDFD21 /* SDLKeyboardLayoutCapabilitySpec.m in Sources */, 885468382225CBA400994D8D /* SDLCloudAppPropertiesSpec.m in Sources */, 88A795D5210678E000056542 /* SDLStaticIconNameSpec.m in Sources */, 1680B1131A9CD7AD00DBD79E /* SDLProtocolHeaderSpec.m in Sources */, diff --git a/SmartDeviceLink/private/SDLChoiceSetManager.m b/SmartDeviceLink/private/SDLChoiceSetManager.m index 51dd32b9e..0f2cb67ad 100644 --- a/SmartDeviceLink/private/SDLChoiceSetManager.m +++ b/SmartDeviceLink/private/SDLChoiceSetManager.m @@ -379,10 +379,10 @@ UInt16 const ChoiceCellCancelIdMin = 1; SDLPresentChoiceSetOperation *presentOp = nil; if (delegate == nil) { // Non-searchable choice set - presentOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:self.connectionManager choiceSet:self.pendingPresentationSet mode:mode keyboardProperties:nil keyboardDelegate:nil cancelID:self.nextCancelId]; + presentOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:self.connectionManager choiceSet:self.pendingPresentationSet mode:mode keyboardProperties:nil keyboardDelegate:nil cancelID:self.nextCancelId windowCapability:self.currentWindowCapability]; } else { // Searchable choice set - presentOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:self.connectionManager choiceSet:self.pendingPresentationSet mode:mode keyboardProperties:self.keyboardConfiguration keyboardDelegate:delegate cancelID:self.nextCancelId]; + presentOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:self.connectionManager choiceSet:self.pendingPresentationSet mode:mode keyboardProperties:self.keyboardConfiguration keyboardDelegate:delegate cancelID:self.nextCancelId windowCapability:self.currentWindowCapability]; } self.pendingPresentOperation = presentOp; @@ -421,7 +421,7 @@ UInt16 const ChoiceCellCancelIdMin = 1; SDLLogD(@"Presenting keyboard with initial text: %@", initialText); // Present a keyboard with the choice set that we used to test VR's optional state UInt16 keyboardCancelId = self.nextCancelId; - self.pendingPresentOperation = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:self.connectionManager keyboardProperties:self.keyboardConfiguration initialText:initialText keyboardDelegate:delegate cancelID:keyboardCancelId]; + self.pendingPresentOperation = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:self.connectionManager keyboardProperties:self.keyboardConfiguration initialText:initialText keyboardDelegate:delegate cancelID:keyboardCancelId windowCapability:self.currentWindowCapability]; [self.transactionQueue addOperation:self.pendingPresentOperation]; return @(keyboardCancelId); } @@ -515,7 +515,7 @@ UInt16 const ChoiceCellCancelIdMin = 1; } - (SDLKeyboardProperties *)sdl_defaultKeyboardConfiguration { - return [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; + return [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil maskInputCharacters:nil customKeys:nil]; } #pragma mark - Getters diff --git a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.h b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.h index df82bfa22..b2589a280 100644 --- a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.h +++ b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.h @@ -15,6 +15,7 @@ @class SDLChoiceCell; @class SDLChoiceSet; @class SDLKeyboardProperties; +@class SDLWindowCapability; @protocol SDLConnectionManagerType; @protocol SDLKeyboardDelegate; @@ -54,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN @param cancelID A unique ID for this specific choice set that allows cancellation through the `CancelInteraction` RPC. @return A SDLPresentChoiceSetOperation object */ -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager choiceSet:(SDLChoiceSet *)choiceSet mode:(SDLInteractionMode)mode keyboardProperties:(nullable SDLKeyboardProperties *)originalKeyboardProperties keyboardDelegate:(nullable id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID; +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager choiceSet:(SDLChoiceSet *)choiceSet mode:(SDLInteractionMode)mode keyboardProperties:(nullable SDLKeyboardProperties *)originalKeyboardProperties keyboardDelegate:(nullable id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID windowCapability:(SDLWindowCapability *)windowCapability; @end diff --git a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m index f0fbbf28a..121383ce7 100644 --- a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m +++ b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m @@ -24,6 +24,7 @@ #import "SDLRPCNotificationNotification.h" #import "SDLSetGlobalProperties.h" #import "SDLVersion.h" +#import "SDLWindowCapability+ScreenManagerExtensions.h" NS_ASSUME_NONNULL_BEGIN @@ -60,12 +61,13 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, readwrite, nullable) SDLChoiceCell *selectedCell; @property (strong, nonatomic, readwrite, nullable) SDLTriggerSource selectedTriggerSource; @property (assign, nonatomic, readwrite) NSUInteger selectedCellRow; +@property (strong, nonatomic) SDLWindowCapability *windowCapability; @end @implementation SDLPresentChoiceSetOperation -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager choiceSet:(SDLChoiceSet *)choiceSet mode:(SDLInteractionMode)mode keyboardProperties:(nullable SDLKeyboardProperties *)originalKeyboardProperties keyboardDelegate:(nullable id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID { +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager choiceSet:(SDLChoiceSet *)choiceSet mode:(SDLInteractionMode)mode keyboardProperties:(nullable SDLKeyboardProperties *)originalKeyboardProperties keyboardDelegate:(nullable id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID windowCapability:(SDLWindowCapability *)windowCapability { self = [super init]; if (!self) { return self; } @@ -86,6 +88,7 @@ NS_ASSUME_NONNULL_BEGIN _cancelId = cancelID; _selectedCellRow = NSNotFound; + _windowCapability = windowCapability; return self; } @@ -121,15 +124,16 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Sending Requests - (void)sdl_updateKeyboardPropertiesWithCompletionHandler:(nullable void(^)(void))completionHandler { - if (self.keyboardProperties == nil) { + // Create the keyboard configuration based on the window capability's keyboard capabilities + SDLKeyboardProperties *modifiedKeyboardConfig = [self.windowCapability createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:self.keyboardProperties]; + if (modifiedKeyboardConfig == nil) { if (completionHandler != nil) { completionHandler(); } return; } - SDLSetGlobalProperties *setProperties = [[SDLSetGlobalProperties alloc] init]; - setProperties.keyboardProperties = self.keyboardProperties; + setProperties.keyboardProperties = modifiedKeyboardConfig; __weak typeof(self) weakself = self; [self.connectionManager sendConnectionRequest:setProperties withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { @@ -295,6 +299,12 @@ NS_ASSUME_NONNULL_BEGIN } else if ([onKeyboard.event isEqualToEnum:SDLKeyboardEventAborted] || [onKeyboard.event isEqualToEnum:SDLKeyboardEventCancelled]) { // Notify of abort / cancellation [self.keyboardDelegate keyboardDidAbortWithReason:onKeyboard.event]; + } else if ([onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled] || [onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskDisabled]) { + // Notify of key mask change + if ([self.keyboardDelegate respondsToSelector:@selector(keyboardDidUpdateInputMask:)]) { + BOOL isEnabled = [onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + [self.keyboardDelegate keyboardDidUpdateInputMask:isEnabled]; + } } } diff --git a/SmartDeviceLink/private/SDLPresentKeyboardOperation.h b/SmartDeviceLink/private/SDLPresentKeyboardOperation.h index 9a5a6cfb5..508c948b4 100644 --- a/SmartDeviceLink/private/SDLPresentKeyboardOperation.h +++ b/SmartDeviceLink/private/SDLPresentKeyboardOperation.h @@ -10,6 +10,8 @@ #import "NSNumber+NumberType.h" @class SDLKeyboardProperties; +@class SDLWindowCapability; + @protocol SDLConnectionManagerType; @protocol SDLKeyboardDelegate; @@ -33,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN @param cancelID An ID for this specific keyboard to allow cancellation through the `CancelInteraction` RPC. @return A SDLPresentKeyboardOperation object */ -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager keyboardProperties:(SDLKeyboardProperties *)originalKeyboardProperties initialText:(NSString *)initialText keyboardDelegate:(id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID; +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager keyboardProperties:(SDLKeyboardProperties *)originalKeyboardProperties initialText:(NSString *)initialText keyboardDelegate:(id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID windowCapability:(SDLWindowCapability *)windowCapability; /** Cancels the keyboard-only interface if it is currently showing. If the keyboard has not yet been sent to Core, it will not be sent. diff --git a/SmartDeviceLink/private/SDLPresentKeyboardOperation.m b/SmartDeviceLink/private/SDLPresentKeyboardOperation.m index 798e046af..939869680 100644 --- a/SmartDeviceLink/private/SDLPresentKeyboardOperation.m +++ b/SmartDeviceLink/private/SDLPresentKeyboardOperation.m @@ -21,6 +21,7 @@ #import "SDLRPCNotificationNotification.h" #import "SDLSetGlobalProperties.h" #import "SDLVersion.h" +#import "SDLWindowCapability+ScreenManagerExtensions.h" NS_ASSUME_NONNULL_BEGIN @@ -37,12 +38,13 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, readonly) SDLPerformInteraction *performInteraction; @property (copy, nonatomic, nullable) NSError *internalError; +@property (strong, nonatomic) SDLWindowCapability *windowCapability; @end @implementation SDLPresentKeyboardOperation -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager keyboardProperties:(SDLKeyboardProperties *)originalKeyboardProperties initialText:(NSString *)initialText keyboardDelegate:(id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID { +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager keyboardProperties:(SDLKeyboardProperties *)originalKeyboardProperties initialText:(NSString *)initialText keyboardDelegate:(id<SDLKeyboardDelegate>)keyboardDelegate cancelID:(UInt16)cancelID windowCapability:(SDLWindowCapability *)windowCapability { self = [super init]; if (!self) { return self; } @@ -53,6 +55,7 @@ NS_ASSUME_NONNULL_BEGIN _keyboardProperties = originalKeyboardProperties; _cancelId = cancelID; _operationId = [NSUUID UUID]; + _windowCapability = windowCapability; return self; } @@ -87,8 +90,16 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Sending Requests - (void)sdl_updateKeyboardPropertiesWithCompletionHandler:(nullable void(^)(void))completionHandler { + // Create the keyboard configuration based on the window capability's keyboard capabilities + SDLKeyboardProperties *keyboardConfiguration = [self.windowCapability createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:self.keyboardProperties]; + if (keyboardConfiguration == nil) { + if (completionHandler != nil) { + completionHandler(); + } + return; + } SDLSetGlobalProperties *setProperties = [[SDLSetGlobalProperties alloc] init]; - setProperties.keyboardProperties = self.keyboardProperties; + setProperties.keyboardProperties = keyboardConfiguration; [self.connectionManager sendConnectionRequest:setProperties withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { if (error != nil) { @@ -209,6 +220,12 @@ NS_ASSUME_NONNULL_BEGIN } else if ([onKeyboard.event isEqualToEnum:SDLKeyboardEventAborted] || [onKeyboard.event isEqualToEnum:SDLKeyboardEventCancelled]) { // Notify of abort / cancellation [self.keyboardDelegate keyboardDidAbortWithReason:onKeyboard.event]; + } else if ([onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled] || [onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskDisabled]) { + // Notify of key mask change + if ([self.keyboardDelegate respondsToSelector:@selector(keyboardDidUpdateInputMask:)]) { + BOOL isEnabled = [onKeyboard.event isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + [self.keyboardDelegate keyboardDidUpdateInputMask:isEnabled]; + } } } diff --git a/SmartDeviceLink/private/SDLRPCParameterNames.h b/SmartDeviceLink/private/SDLRPCParameterNames.h index cd34d66e9..d792b9b1a 100644 --- a/SmartDeviceLink/private/SDLRPCParameterNames.h +++ b/SmartDeviceLink/private/SDLRPCParameterNames.h @@ -166,6 +166,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameCurrentForecastSupported; extern SDLRPCParameterName const SDLRPCParameterNameCurrentTemperature; extern SDLRPCParameterName const SDLRPCParameterNameCushion; extern SDLRPCParameterName const SDLRPCParameterNameCustomButtonId; +extern SDLRPCParameterName const SDLRPCParameterNameCustomKeys; extern SDLRPCParameterName const SDLRPCParameterNameCustomPresets; extern SDLRPCParameterName const SDLRPCParameterNameOEMCustomDataType; extern SDLRPCParameterName const SDLRPCParameterNameData; @@ -354,6 +355,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameIsSubscribed; extern SDLRPCParameterName const SDLRPCParameterNameJunctionType; extern SDLRPCParameterName const SDLRPCParameterNameKeepContext; extern SDLRPCParameterName const SDLRPCParameterNameKeepContextAvailable; +extern SDLRPCParameterName const SDLRPCParameterNameKeyboardCapabilities; extern SDLRPCParameterName const SDLRPCParameterNameKeyboardLayout; extern SDLRPCParameterName const SDLRPCParameterNameKeyboardProperties; extern SDLRPCParameterName const SDLRPCParameterNameKeypressMode; @@ -400,6 +402,8 @@ extern SDLRPCParameterName const SDLRPCParameterNameMajorVersion; extern SDLRPCParameterName const SDLRPCParameterNameMake; extern SDLRPCParameterName const SDLRPCParameterNameManeuverComplete; extern SDLRPCParameterName const SDLRPCParameterNameManualTextEntry; +extern SDLRPCParameterName const SDLRPCParameterNameMaskInputCharacters; +extern SDLRPCParameterName const SDLRPCParameterNameMaskInputCharactersSupported; extern SDLRPCParameterName const SDLRPCParameterNameMassageCushionFirmness; extern SDLRPCParameterName const SDLRPCParameterNameMassageCushionFirmnessAvailable; extern SDLRPCParameterName const SDLRPCParameterNameMassageEnabled; @@ -485,6 +489,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameNotification; extern SDLRPCParameterName const SDLRPCParameterNameNumber; extern SDLRPCParameterName const SDLRPCParameterNameNumberCustomPresetsAvailable; extern SDLRPCParameterName const SDLRPCParameterNameNumberTicks; +extern SDLRPCParameterName const SDLRPCParameterNameNumConfigurableKeys; extern SDLRPCParameterName const SDLRPCParameterNameOdometer; extern SDLRPCParameterName const SDLRPCParameterNameOffset; extern SDLRPCParameterName const SDLRPCParameterNameOnLockScreenStatus; @@ -675,6 +680,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameSupportedDiagnosticModes; extern SDLRPCParameterName const SDLRPCParameterNameSupportedDynamicImageFieldNames; extern SDLRPCParameterName const SDLRPCParameterNameSupportsDynamicSubMenus; extern SDLRPCParameterName const SDLRPCParameterNameSupportedFormats; +extern SDLRPCParameterName const SDLRPCParameterNameSupportedKeyboards; extern SDLRPCParameterName const SDLRPCParameterNameSupportedLights; extern SDLRPCParameterName const SDLRPCParameterNameSyncFileName; extern SDLRPCParameterName const SDLRPCParameterNameSyncMessageVersion; diff --git a/SmartDeviceLink/private/SDLRPCParameterNames.m b/SmartDeviceLink/private/SDLRPCParameterNames.m index d95d6af05..04c9e66b8 100644 --- a/SmartDeviceLink/private/SDLRPCParameterNames.m +++ b/SmartDeviceLink/private/SDLRPCParameterNames.m @@ -165,6 +165,7 @@ SDLRPCParameterName const SDLRPCParameterNameCurrentForecastSupported = @"curren SDLRPCParameterName const SDLRPCParameterNameCurrentTemperature = @"currentTemperature"; SDLRPCParameterName const SDLRPCParameterNameCushion = @"cushion"; SDLRPCParameterName const SDLRPCParameterNameCustomButtonId = @"customButtonID"; +SDLRPCParameterName const SDLRPCParameterNameCustomKeys = @"customKeys"; SDLRPCParameterName const SDLRPCParameterNameCustomPresets = @"customPresets"; SDLRPCParameterName const SDLRPCParameterNameData = @"data"; SDLRPCParameterName const SDLRPCParameterNameDataResult = @"dataResult"; @@ -353,6 +354,7 @@ SDLRPCParameterName const SDLRPCParameterNameIsSubscribed = @"isSubscribed"; SDLRPCParameterName const SDLRPCParameterNameJunctionType = @"junctionType"; SDLRPCParameterName const SDLRPCParameterNameKeepContext = @"keepContext"; SDLRPCParameterName const SDLRPCParameterNameKeepContextAvailable = @"keepContextAvailable"; +SDLRPCParameterName const SDLRPCParameterNameKeyboardCapabilities = @"keyboardCapabilities"; SDLRPCParameterName const SDLRPCParameterNameKeyboardLayout = @"keyboardLayout"; SDLRPCParameterName const SDLRPCParameterNameKeyboardProperties = @"keyboardProperties"; SDLRPCParameterName const SDLRPCParameterNameKeypressMode = @"keypressMode"; @@ -395,6 +397,8 @@ SDLRPCParameterName const SDLRPCParameterNameMajorVersion = @"majorVersion"; SDLRPCParameterName const SDLRPCParameterNameMake = @"make"; SDLRPCParameterName const SDLRPCParameterNameManeuverComplete = @"maneuverComplete"; SDLRPCParameterName const SDLRPCParameterNameManualTextEntry = @"manualTextEntry"; +SDLRPCParameterName const SDLRPCParameterNameMaskInputCharacters = @"maskInputCharacters"; +SDLRPCParameterName const SDLRPCParameterNameMaskInputCharactersSupported = @"maskInputCharactersSupported"; SDLRPCParameterName const SDLRPCParameterNameMassageCushionFirmness = @"massageCushionFirmness"; SDLRPCParameterName const SDLRPCParameterNameMassageCushionFirmnessAvailable = @"massageCushionFirmnessAvailable"; SDLRPCParameterName const SDLRPCParameterNameMassageEnabled = @"massageEnabled"; @@ -480,6 +484,7 @@ SDLRPCParameterName const SDLRPCParameterNameNotification = @"notification"; SDLRPCParameterName const SDLRPCParameterNameNumber = @"number"; SDLRPCParameterName const SDLRPCParameterNameNumberCustomPresetsAvailable = @"numCustomPresetsAvailable"; SDLRPCParameterName const SDLRPCParameterNameNumberTicks = @"numTicks"; +SDLRPCParameterName const SDLRPCParameterNameNumConfigurableKeys = @"numConfigurableKeys"; SDLRPCParameterName const SDLRPCParameterNameOdometer = @"odometer"; SDLRPCParameterName const SDLRPCParameterNameOEMCustomDataType = @"oemCustomDataType"; SDLRPCParameterName const SDLRPCParameterNameOffset = @"offset"; @@ -671,6 +676,7 @@ SDLRPCParameterName const SDLRPCParameterNameSupportedDiagnosticModes = @"suppor SDLRPCParameterName const SDLRPCParameterNameSupportedDynamicImageFieldNames = @"supportedDynamicImageFieldNames"; SDLRPCParameterName const SDLRPCParameterNameSupportsDynamicSubMenus = @"supportsDynamicSubMenus"; SDLRPCParameterName const SDLRPCParameterNameSupportedFormats = @"supportedFormats"; +SDLRPCParameterName const SDLRPCParameterNameSupportedKeyboards = @"supportedKeyboards"; SDLRPCParameterName const SDLRPCParameterNameSupportedLights = @"supportedLights"; SDLRPCParameterName const SDLRPCParameterNameSyncFileName = @"syncFileName"; SDLRPCParameterName const SDLRPCParameterNameSyncMessageVersion = @"syncMsgVersion"; diff --git a/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.h b/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.h index 9321c98cd..ca095da24 100644 --- a/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.h +++ b/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.h @@ -12,6 +12,8 @@ #import "SDLTextFieldName.h" #import "SDLWindowCapability.h" +@class SDLKeyboardProperties; + NS_ASSUME_NONNULL_BEGIN @interface SDLWindowCapability (ScreenManagerExtensions) @@ -21,6 +23,13 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)hasTextFieldOfName:(SDLTextFieldName)name; - (BOOL)hasImageFieldOfName:(SDLImageFieldName)name; +/// Takes a keyboard configuration (SDLKeyboardProperties) and creates a valid version of it, if possible, based on this object's internal keyboardCapabilities (SDLKeyboardCapabilities). +/// If there is no internal keyboardCapabilities, it will just return the passed configuration as-is. +/// If no valid configuration can be determined based on the internal keyboard capabilities, it will return nil. +/// @param keyboardConfiguration The configuration to use to determine a valid configuration +/// @return The passed keyboardConfiguration if there are no changes needed or possible, a modified keyboardConfiguration if a valid version of the configuration could be determined, or nil if a valid configuration could not be created +- (nullable SDLKeyboardProperties *)createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:(nullable SDLKeyboardProperties *)keyboardConfiguration; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.m b/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.m index 441356a83..9aa00fa62 100644 --- a/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.m +++ b/SmartDeviceLink/private/SDLWindowCapability+ScreenManagerExtensions.m @@ -10,6 +10,10 @@ #import "SDLWindowCapability+ScreenManagerExtensions.h" #import "SDLImageField.h" +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayoutCapability.h" +#import "SDLKeyboardProperties.h" +#import "SDLLogMacros.h" #import "SDLTextField.h" @implementation SDLWindowCapability (ScreenManagerExtensions) @@ -52,4 +56,44 @@ return NO; } +- (nullable SDLKeyboardProperties *)createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:(nullable SDLKeyboardProperties *)keyboardConfiguration { + // If there are no keyboard capabilities, if there is no passed keyboard configuration, or if there is no layout to the passed keyboard configuration, just pass back the passed in configuration + if ((self.keyboardCapabilities == nil) || (keyboardConfiguration == nil) || (keyboardConfiguration.keyboardLayout == nil)) { + return keyboardConfiguration; + } + + // Find the capability for the keyboard configuration's layout + SDLKeyboardLayoutCapability *selectedLayoutCapability = nil; + for (SDLKeyboardLayoutCapability *layoutCapability in self.keyboardCapabilities.supportedKeyboards) { + if ([layoutCapability.keyboardLayout isEqualToEnum:keyboardConfiguration.keyboardLayout]) { + selectedLayoutCapability = layoutCapability; + break; + } + } + if (selectedLayoutCapability == nil) { + SDLLogE(@"Configured keyboard layout is not supported: %@", keyboardConfiguration.keyboardLayout); + return nil; + } + + // Modify the keyboard configuration if there are fewer customKeys allowed than were set, or if an empty array was set. + SDLKeyboardProperties *modifiedKeyboardConfiguration = [keyboardConfiguration copy]; + if (keyboardConfiguration.customKeys.count == 0) { + modifiedKeyboardConfiguration.customKeys = nil; + } else { + NSUInteger numConfigurableKeys = selectedLayoutCapability.numConfigurableKeys.unsignedIntegerValue; + if (modifiedKeyboardConfiguration.customKeys.count > numConfigurableKeys) { + SDLLogW(@"%lu custom keys set, but the selected layout: %@ only supports %lu. Dropping the rest.", (unsigned long)modifiedKeyboardConfiguration.customKeys.count, modifiedKeyboardConfiguration.keyboardLayout, (unsigned long)numConfigurableKeys); + // If there are more custom keys than are allowed for the selected keyboard layout, we need to trim the number of keys to only use the first n number of custom keys, where n is the number of allowed custom keys for that layout. + modifiedKeyboardConfiguration.customKeys = [modifiedKeyboardConfiguration.customKeys subarrayWithRange:NSMakeRange(0, numConfigurableKeys)]; + } + } + + // If the keyboard does not support masking input characters, we will remove it from the keyboard configuration + if (!self.keyboardCapabilities.maskInputCharactersSupported.boolValue) { + modifiedKeyboardConfiguration.maskInputCharacters = nil; + } + + return modifiedKeyboardConfiguration; +} + @end diff --git a/SmartDeviceLink/public/SDLKeyboardCapabilities.h b/SmartDeviceLink/public/SDLKeyboardCapabilities.h new file mode 100644 index 000000000..9ed4e831e --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardCapabilities.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SDLRPCStruct.h" + +@class SDLKeyboardLayoutCapability; + +NS_ASSUME_NONNULL_BEGIN + +/** + * @added in SmartDeviceLink 7.1.0 + */ +@interface SDLKeyboardCapabilities : SDLRPCStruct + +/** + * @param maskInputCharactersSupported - maskInputCharactersSupported + * @param supportedKeyboards - supportedKeyboards + * @return A SDLKeyboardCapabilities object + */ +- (instancetype)initWithMaskInputCharactersSupported:(nullable NSNumber<SDLBool> *)maskInputCharactersSupported supportedKeyboards:(nullable NSArray<SDLKeyboardLayoutCapability *> *)supportedKeyboards; + +/** + * Availability of capability to mask input characters using keyboard. True: Available, False: Not Available + */ +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *maskInputCharactersSupported; + +/** + * Capabilities of supported keyboard layouts by HMI. + * {"array_min_size": 1, "array_max_size": 1000} + */ +@property (nullable, strong, nonatomic) NSArray<SDLKeyboardLayoutCapability *> *supportedKeyboards; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardCapabilities.m b/SmartDeviceLink/public/SDLKeyboardCapabilities.m new file mode 100644 index 000000000..27799f17a --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardCapabilities.m @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "NSMutableDictionary+Store.h" +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayoutCapability.h" +#import "SDLRPCParameterNames.h" + +NS_ASSUME_NONNULL_BEGIN + +@implementation SDLKeyboardCapabilities + +- (instancetype)initWithMaskInputCharactersSupported:(nullable NSNumber<SDLBool> *)maskInputCharactersSupported supportedKeyboards:(nullable NSArray<SDLKeyboardLayoutCapability *> *)supportedKeyboards { + self = [self init]; + if (!self) { + return nil; + } + self.maskInputCharactersSupported = maskInputCharactersSupported; + self.supportedKeyboards = supportedKeyboards; + return self; +} + +- (void)setMaskInputCharactersSupported:(nullable NSNumber<SDLBool> *)maskInputCharactersSupported { + [self.store sdl_setObject:maskInputCharactersSupported forName:SDLRPCParameterNameMaskInputCharactersSupported]; +} + +- (nullable NSNumber<SDLBool> *)maskInputCharactersSupported { + return [self.store sdl_objectForName:SDLRPCParameterNameMaskInputCharactersSupported ofClass:NSNumber.class error:nil]; +} + +- (void)setSupportedKeyboards:(nullable NSArray<SDLKeyboardLayoutCapability *> *)supportedKeyboards { + [self.store sdl_setObject:supportedKeyboards forName:SDLRPCParameterNameSupportedKeyboards]; +} + +- (nullable NSArray<SDLKeyboardLayoutCapability *> *)supportedKeyboards { + return [self.store sdl_objectsForName:SDLRPCParameterNameSupportedKeyboards ofClass:SDLKeyboardLayoutCapability.class error:nil]; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardDelegate.h b/SmartDeviceLink/public/SDLKeyboardDelegate.h index 652066d64..33da49969 100644 --- a/SmartDeviceLink/public/SDLKeyboardDelegate.h +++ b/SmartDeviceLink/public/SDLKeyboardDelegate.h @@ -93,6 +93,14 @@ typedef void(^SDLKeyboardCharacterSetCompletionHandler)(NSArray<NSString *> *_Nu */ - (void)keyboardDidSendEvent:(SDLKeyboardEvent)event text:(NSString *)currentInputText; +/** + Implement this to be notified of input key mask update (whether or not the user has changed the input to be hidden, like passwords) + + @param isEnabled - YES if the mask is enabled, NO if the mask is disabled + @added in SmartDeviceLink 7.1.0 + */ +- (void)keyboardDidUpdateInputMask:(BOOL)isEnabled; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardEvent.h b/SmartDeviceLink/public/SDLKeyboardEvent.h index 1ac7b67e4..9e017c8d6 100644 --- a/SmartDeviceLink/public/SDLKeyboardEvent.h +++ b/SmartDeviceLink/public/SDLKeyboardEvent.h @@ -37,3 +37,13 @@ extern SDLKeyboardEvent const SDLKeyboardEventAborted; @since SDL 4.0 */ extern SDLKeyboardEvent const SDLKeyboardEventVoice; + +/** + * @added in SmartDeviceLink 7.1.0 + */ +extern SDLKeyboardEvent const SDLKeyboardEventInputKeyMaskEnabled; + +/** + * @added in SmartDeviceLink 7.1.0 + */ +extern SDLKeyboardEvent const SDLKeyboardEventInputKeyMaskDisabled; diff --git a/SmartDeviceLink/public/SDLKeyboardEvent.m b/SmartDeviceLink/public/SDLKeyboardEvent.m index 67f4e60f2..f55ac3597 100644 --- a/SmartDeviceLink/public/SDLKeyboardEvent.m +++ b/SmartDeviceLink/public/SDLKeyboardEvent.m @@ -9,3 +9,5 @@ SDLKeyboardEvent const SDLKeyboardEventSubmitted = @"ENTRY_SUBMITTED"; SDLKeyboardEvent const SDLKeyboardEventCancelled = @"ENTRY_CANCELLED"; SDLKeyboardEvent const SDLKeyboardEventAborted = @"ENTRY_ABORTED"; SDLKeyboardEvent const SDLKeyboardEventVoice = @"ENTRY_VOICE"; +SDLKeyboardEvent const SDLKeyboardEventInputKeyMaskEnabled = @"INPUT_KEY_MASK_ENABLED"; +SDLKeyboardEvent const SDLKeyboardEventInputKeyMaskDisabled = @"INPUT_KEY_MASK_DISABLED"; diff --git a/SmartDeviceLink/public/SDLKeyboardInputMask.h b/SmartDeviceLink/public/SDLKeyboardInputMask.h new file mode 100644 index 000000000..fc16b1756 --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardInputMask.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SDLEnum.h" + +/** + * Enumeration listing possible input character masking. + * + * @added in SmartDeviceLink 7.1.0 + */ +typedef SDLEnum SDLKeyboardInputMask NS_TYPED_ENUM; + +extern SDLKeyboardInputMask const SDLKeyboardInputMaskEnableInputKeyMask; + +extern SDLKeyboardInputMask const SDLKeyboardInputMaskDisableInputKeyMask; + +extern SDLKeyboardInputMask const SDLKeyboardInputMaskUserChoiceInputKeyMask; diff --git a/SmartDeviceLink/public/SDLKeyboardInputMask.m b/SmartDeviceLink/public/SDLKeyboardInputMask.m new file mode 100644 index 000000000..e8be72db1 --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardInputMask.m @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SDLKeyboardInputMask.h" + +SDLKeyboardInputMask const SDLKeyboardInputMaskEnableInputKeyMask = @"ENABLE_INPUT_KEY_MASK"; +SDLKeyboardInputMask const SDLKeyboardInputMaskDisableInputKeyMask = @"DISABLE_INPUT_KEY_MASK"; +SDLKeyboardInputMask const SDLKeyboardInputMaskUserChoiceInputKeyMask = @"USER_CHOICE_INPUT_KEY_MASK"; diff --git a/SmartDeviceLink/public/SDLKeyboardLayout.h b/SmartDeviceLink/public/SDLKeyboardLayout.h index 4b4e97550..181836146 100644 --- a/SmartDeviceLink/public/SDLKeyboardLayout.h +++ b/SmartDeviceLink/public/SDLKeyboardLayout.h @@ -25,3 +25,8 @@ extern SDLKeyboardLayout const SDLKeyboardLayoutQWERTZ; AZERTY layout (the name comes from the first six keys<br> appearing on the top left letter row of the keyboard and read from left to right) */ extern SDLKeyboardLayout const SDLKeyboardLayoutAZERTY; + +/** + * @added in SmartDeviceLink 7.1.0 + */ +extern SDLKeyboardLayout const SDLKeyboardLayoutNumeric; diff --git a/SmartDeviceLink/public/SDLKeyboardLayout.m b/SmartDeviceLink/public/SDLKeyboardLayout.m index 7fa8e1958..0bc5ecc3b 100644 --- a/SmartDeviceLink/public/SDLKeyboardLayout.m +++ b/SmartDeviceLink/public/SDLKeyboardLayout.m @@ -7,3 +7,4 @@ SDLKeyboardLayout const SDLKeyboardLayoutQWERTY = @"QWERTY"; SDLKeyboardLayout const SDLKeyboardLayoutQWERTZ = @"QWERTZ"; SDLKeyboardLayout const SDLKeyboardLayoutAZERTY = @"AZERTY"; +SDLKeyboardLayout const SDLKeyboardLayoutNumeric = @"NUMERIC"; diff --git a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h new file mode 100644 index 000000000..b78218663 --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "SDLKeyboardLayout.h" +#import "SDLRPCStruct.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Describes the capabilities of a single keyboard layout. + * + * @added in SmartDeviceLink 7.1.0 + */ +@interface SDLKeyboardLayoutCapability : SDLRPCStruct + +/** + * @param keyboardLayout - keyboardLayout + * @param numConfigurableKeys - @(numConfigurableKeys) + * @return A SDLKeyboardLayoutCapability object + */ +- (instancetype)initWithKeyboardLayout:(SDLKeyboardLayout)keyboardLayout numConfigurableKeys:(UInt8)numConfigurableKeys; + +@property (strong, nonatomic) SDLKeyboardLayout keyboardLayout; + +/** + * Number of keys available for special characters, App can customize as per their needs. + * {"num_min_value": 0, "num_max_value": 10} + */ +@property (strong, nonatomic) NSNumber<SDLUInt> *numConfigurableKeys; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m new file mode 100644 index 000000000..57cb9a81c --- /dev/null +++ b/SmartDeviceLink/public/SDLKeyboardLayoutCapability.m @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2021, SmartDeviceLink Consortium, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "NSMutableDictionary+Store.h" +#import "SDLKeyboardLayout.h" +#import "SDLKeyboardLayoutCapability.h" +#import "SDLRPCParameterNames.h" + +NS_ASSUME_NONNULL_BEGIN + +@implementation SDLKeyboardLayoutCapability + +- (instancetype)initWithKeyboardLayout:(SDLKeyboardLayout)keyboardLayout numConfigurableKeys:(UInt8)numConfigurableKeys { + self = [self init]; + if (!self) { + return nil; + } + self.keyboardLayout = keyboardLayout; + self.numConfigurableKeys = @(numConfigurableKeys); + return self; +} + +- (void)setKeyboardLayout:(SDLKeyboardLayout)keyboardLayout { + [self.store sdl_setObject:keyboardLayout forName:SDLRPCParameterNameKeyboardLayout]; +} + +- (SDLKeyboardLayout)keyboardLayout { + NSError *error = nil; + return [self.store sdl_enumForName:SDLRPCParameterNameKeyboardLayout error:&error]; +} + +- (void)setNumConfigurableKeys:(NSNumber<SDLUInt> *)numConfigurableKeys { + [self.store sdl_setObject:numConfigurableKeys forName:SDLRPCParameterNameNumConfigurableKeys]; +} + +- (NSNumber<SDLUInt> *)numConfigurableKeys { + NSError *error = nil; + return [self.store sdl_objectForName:SDLRPCParameterNameNumConfigurableKeys ofClass:NSNumber.class error:&error]; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardProperties.h b/SmartDeviceLink/public/SDLKeyboardProperties.h index a538b52bd..55a3ed1b0 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.h +++ b/SmartDeviceLink/public/SDLKeyboardProperties.h @@ -1,11 +1,11 @@ // SDLKeyboardProperties.h // -#import "SDLRPCMessage.h" - +#import "SDLKeyboardInputMask.h" #import "SDLKeyboardLayout.h" #import "SDLKeypressMode.h" #import "SDLLanguage.h" +#import "SDLRPCStruct.h" NS_ASSUME_NONNULL_BEGIN @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @param autoCompleteList A list of strings to show the user to complete what they are typing. @return The RPC object */ -- (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList __deprecated_msg("Use initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList: instead"); +- (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList __deprecated_msg("Use initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:maskInputCharacters:customKeys: instead"); /** * Convenience init with all properties. @@ -37,7 +37,19 @@ NS_ASSUME_NONNULL_BEGIN * @param autoCompleteList - autoCompleteList * @return A SDLKeyboardProperties object */ -- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList; +- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList __deprecated_msg("Use initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:maskInputCharacters:customKeys: instead"); + +/** + * @param language - language + * @param keyboardLayout - keyboardLayout + * @param keypressMode - keypressMode + * @param limitedCharacterList - limitedCharacterList + * @param autoCompleteList - autoCompleteList + * @param maskInputCharacters - maskInputCharacters + * @param customKeys - customKeys + * @return A SDLKeyboardProperties object + */ +- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList maskInputCharacters:(nullable SDLKeyboardInputMask)maskInputCharacters customKeys:(nullable NSArray<NSString *> *)customKeys; /** The keyboard language @@ -85,6 +97,21 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, strong, nonatomic) NSArray<NSString *> *autoCompleteList; +/** + * Allows an app to mask entered characters on HMI + * + * @added in SmartDeviceLink 7.1.0 + */ +@property (nullable, strong, nonatomic) SDLKeyboardInputMask maskInputCharacters; + +/** + * Array of special characters to show in customizable keys. If omitted, keyboard will show default special characters + * {"array_min_size": 1, "array_max_size": 10, "string_min_length": 1, "string_max_length": 1} + * + * @added in SmartDeviceLink 7.1.0 + */ +@property (nullable, strong, nonatomic) NSArray<NSString *> *customKeys; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLKeyboardProperties.m b/SmartDeviceLink/public/SDLKeyboardProperties.m index c21c91bc7..d57a21c2c 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.m +++ b/SmartDeviceLink/public/SDLKeyboardProperties.m @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLKeyboardProperties - (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList { - self = [[self init] initWithLanguage:language keyboardLayout:layout keypressMode:keypressMode limitedCharacterList:limitedCharacterList autoCompleteList:autoCompleteList]; + self = [self initWithLanguage:language keyboardLayout:layout keypressMode:keypressMode limitedCharacterList:limitedCharacterList autoCompleteList:autoCompleteList maskInputCharacters:nil customKeys:nil]; if (!self) { return nil; } self.autoCompleteText = autoCompleteText; @@ -19,17 +19,21 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList { + return [self initWithLanguage:language keyboardLayout:keyboardLayout keypressMode:keypressMode limitedCharacterList:limitedCharacterList autoCompleteList:autoCompleteList maskInputCharacters:nil customKeys:nil]; +} + +- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList maskInputCharacters:(nullable SDLKeyboardInputMask)maskInputCharacters customKeys:(nullable NSArray<NSString *> *)customKeys { self = [self init]; if (!self) { return nil; } - self.language = language; self.keyboardLayout = keyboardLayout; self.keypressMode = keypressMode; self.limitedCharacterList = limitedCharacterList; self.autoCompleteList = autoCompleteList; - + self.maskInputCharacters = maskInputCharacters; + self.customKeys = customKeys; return self; } @@ -81,6 +85,22 @@ NS_ASSUME_NONNULL_BEGIN return [self.store sdl_objectsForName:SDLRPCParameterNameAutoCompleteList ofClass:NSString.class error:nil]; } +- (void)setMaskInputCharacters:(nullable SDLKeyboardInputMask)maskInputCharacters { + [self.store sdl_setObject:maskInputCharacters forName:SDLRPCParameterNameMaskInputCharacters]; +} + +- (nullable SDLKeyboardInputMask)maskInputCharacters { + return [self.store sdl_enumForName:SDLRPCParameterNameMaskInputCharacters error:nil]; +} + +- (void)setCustomKeys:(nullable NSArray<NSString *> *)customKeys { + [self.store sdl_setObject:customKeys forName:SDLRPCParameterNameCustomKeys]; +} + +- (nullable NSArray<NSString *> *)customKeys { + return [self.store sdl_objectsForName:SDLRPCParameterNameCustomKeys ofClass:NSString.class error:nil]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLWindowCapability.h b/SmartDeviceLink/public/SDLWindowCapability.h index 4795e667b..afb7a905e 100644 --- a/SmartDeviceLink/public/SDLWindowCapability.h +++ b/SmartDeviceLink/public/SDLWindowCapability.h @@ -38,10 +38,10 @@ @class SDLButtonCapabilities; @class SDLDynamicUpdateCapabilities; @class SDLImageField; +@class SDLKeyboardCapabilities; @class SDLSoftButtonCapabilities; @class SDLTextField; - NS_ASSUME_NONNULL_BEGIN /** @@ -64,7 +64,23 @@ NS_ASSUME_NONNULL_BEGIN * @param dynamicUpdateCapabilities - dynamicUpdateCapabilities * @return A SDLWindowCapability object */ -- (instancetype)initWithWindowID:(nullable NSNumber<SDLInt> *)windowID textFields:(nullable NSArray<SDLTextField *> *)textFields imageFields:(nullable NSArray<SDLImageField *> *)imageFields imageTypeSupported:(nullable NSArray<SDLImageType> *)imageTypeSupported templatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable numCustomPresetsAvailable:(nullable NSNumber<SDLUInt> *)numCustomPresetsAvailable buttonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities softButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities menuLayoutsAvailable:(nullable NSArray<SDLMenuLayout> *)menuLayoutsAvailable dynamicUpdateCapabilities:(nullable SDLDynamicUpdateCapabilities *)dynamicUpdateCapabilities; +- (instancetype)initWithWindowID:(nullable NSNumber<SDLInt> *)windowID textFields:(nullable NSArray<SDLTextField *> *)textFields imageFields:(nullable NSArray<SDLImageField *> *)imageFields imageTypeSupported:(nullable NSArray<SDLImageType> *)imageTypeSupported templatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable numCustomPresetsAvailable:(nullable NSNumber<SDLUInt> *)numCustomPresetsAvailable buttonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities softButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities menuLayoutsAvailable:(nullable NSArray<SDLMenuLayout> *)menuLayoutsAvailable dynamicUpdateCapabilities:(nullable SDLDynamicUpdateCapabilities *)dynamicUpdateCapabilities __deprecated_msg("please use initWithWindowID:textFields:imageFields:imageTypeSupported:templatesAvailable:numCustomPresetsAvailable:buttonCapabilities:softButtonCapabilities:menuLayoutsAvailable:dynamicUpdateCapabilities:keyboardCapabilities: instead"); + +/** + * @param windowID - windowID + * @param textFields - textFields + * @param imageFields - imageFields + * @param imageTypeSupported - imageTypeSupported + * @param templatesAvailable - templatesAvailable + * @param numCustomPresetsAvailable - numCustomPresetsAvailable + * @param buttonCapabilities - buttonCapabilities + * @param softButtonCapabilities - softButtonCapabilities + * @param menuLayoutsAvailable - menuLayoutsAvailable + * @param dynamicUpdateCapabilities - dynamicUpdateCapabilities + * @param keyboardCapabilities - keyboardCapabilities + * @return A SDLWindowCapability object + */ +- (instancetype)initWithWindowID:(nullable NSNumber<SDLInt> *)windowID textFields:(nullable NSArray<SDLTextField *> *)textFields imageFields:(nullable NSArray<SDLImageField *> *)imageFields imageTypeSupported:(nullable NSArray<SDLImageType> *)imageTypeSupported templatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable numCustomPresetsAvailable:(nullable NSNumber<SDLUInt> *)numCustomPresetsAvailable buttonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities softButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities menuLayoutsAvailable:(nullable NSArray<SDLMenuLayout> *)menuLayoutsAvailable dynamicUpdateCapabilities:(nullable SDLDynamicUpdateCapabilities *)dynamicUpdateCapabilities keyboardCapabilities:(nullable SDLKeyboardCapabilities *)keyboardCapabilities; /** The specified ID of the window. Can be set to a predefined window, or omitted for the main window on the main display. @@ -136,6 +152,13 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, strong, nonatomic) SDLDynamicUpdateCapabilities *dynamicUpdateCapabilities; +/** + * See KeyboardCapabilities + * + * @added in SmartDeviceLink 7.1.0 + */ +@property (nullable, strong, nonatomic) SDLKeyboardCapabilities *keyboardCapabilities; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/public/SDLWindowCapability.m b/SmartDeviceLink/public/SDLWindowCapability.m index 9c3ebe7e2..3db3195ff 100644 --- a/SmartDeviceLink/public/SDLWindowCapability.m +++ b/SmartDeviceLink/public/SDLWindowCapability.m @@ -36,6 +36,7 @@ #import "SDLButtonCapabilities.h" #import "SDLDynamicUpdateCapabilities.h" #import "SDLImageField.h" +#import "SDLKeyboardCapabilities.h" #import "SDLRPCParameterNames.h" #import "SDLSoftButtonCapabilities.h" #import "SDLTextField.h" @@ -43,6 +44,10 @@ @implementation SDLWindowCapability - (instancetype)initWithWindowID:(nullable NSNumber<SDLInt> *)windowID textFields:(nullable NSArray<SDLTextField *> *)textFields imageFields:(nullable NSArray<SDLImageField *> *)imageFields imageTypeSupported:(nullable NSArray<SDLImageType> *)imageTypeSupported templatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable numCustomPresetsAvailable:(nullable NSNumber<SDLUInt> *)numCustomPresetsAvailable buttonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities softButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities menuLayoutsAvailable:(nullable NSArray<SDLMenuLayout> *)menuLayoutsAvailable dynamicUpdateCapabilities:(nullable SDLDynamicUpdateCapabilities *)dynamicUpdateCapabilities { + return [self initWithWindowID:windowID textFields:textFields imageFields:imageFields imageTypeSupported:imageTypeSupported templatesAvailable:templatesAvailable numCustomPresetsAvailable:numCustomPresetsAvailable buttonCapabilities:buttonCapabilities softButtonCapabilities:softButtonCapabilities menuLayoutsAvailable:menuLayoutsAvailable dynamicUpdateCapabilities:dynamicUpdateCapabilities keyboardCapabilities:nil]; +} + +- (instancetype)initWithWindowID:(nullable NSNumber<SDLInt> *)windowID textFields:(nullable NSArray<SDLTextField *> *)textFields imageFields:(nullable NSArray<SDLImageField *> *)imageFields imageTypeSupported:(nullable NSArray<SDLImageType> *)imageTypeSupported templatesAvailable:(nullable NSArray<NSString *> *)templatesAvailable numCustomPresetsAvailable:(nullable NSNumber<SDLUInt> *)numCustomPresetsAvailable buttonCapabilities:(nullable NSArray<SDLButtonCapabilities *> *)buttonCapabilities softButtonCapabilities:(nullable NSArray<SDLSoftButtonCapabilities *> *)softButtonCapabilities menuLayoutsAvailable:(nullable NSArray<SDLMenuLayout> *)menuLayoutsAvailable dynamicUpdateCapabilities:(nullable SDLDynamicUpdateCapabilities *)dynamicUpdateCapabilities keyboardCapabilities:(nullable SDLKeyboardCapabilities *)keyboardCapabilities { self = [super init]; if (!self) { return nil; @@ -57,6 +62,7 @@ self.softButtonCapabilities = softButtonCapabilities; self.menuLayoutsAvailable = menuLayoutsAvailable; self.dynamicUpdateCapabilities = dynamicUpdateCapabilities; + self.keyboardCapabilities = keyboardCapabilities; return self; } @@ -141,4 +147,12 @@ return [self.store sdl_objectForName:SDLRPCParameterNameDynamicUpdateCapabilities ofClass:SDLDynamicUpdateCapabilities.class error:nil]; } +- (void)setKeyboardCapabilities:(nullable SDLKeyboardCapabilities *)keyboardCapabilities { + [self.store sdl_setObject:keyboardCapabilities forName:SDLRPCParameterNameKeyboardCapabilities]; +} + +- (nullable SDLKeyboardCapabilities *)keyboardCapabilities { + return [self.store sdl_objectForName:SDLRPCParameterNameKeyboardCapabilities ofClass:SDLKeyboardCapabilities.class error:nil]; +} + @end diff --git a/SmartDeviceLink/public/SmartDeviceLink.h b/SmartDeviceLink/public/SmartDeviceLink.h index 8b8b6f68d..16a573ebf 100644 --- a/SmartDeviceLink/public/SmartDeviceLink.h +++ b/SmartDeviceLink/public/SmartDeviceLink.h @@ -225,6 +225,8 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLImage.h" #import "SDLImageField.h" #import "SDLImageResolution.h" +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayoutCapability.h" #import "SDLKeyboardProperties.h" #import "SDLLightCapabilities.h" #import "SDLLightControlCapabilities.h" @@ -340,6 +342,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLImageType.h" #import "SDLInteractionMode.h" #import "SDLKeyboardEvent.h" +#import "SDLKeyboardInputMask.h" #import "SDLKeyboardLayout.h" #import "SDLKeypressMode.h" #import "SDLLanguage.h" diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m index 321a2dde6..2d3fa0707 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m @@ -105,7 +105,7 @@ describe(@"choice set manager tests", ^{ it(@"should be in the correct startup state", ^{ expect(testManager.currentState).to(equal(SDLChoiceManagerStateShutdown)); - SDLKeyboardProperties *defaultProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; + SDLKeyboardProperties *defaultProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil maskInputCharacters:nil customKeys:nil]; expect(testManager.keyboardConfiguration).to(equal(defaultProperties)); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m index 883720b82..f918c6909 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m @@ -46,6 +46,7 @@ describe(@"present choice operation", ^{ __block BOOL hasCalledOperationCompletionHandler = NO; __block NSError *resultError = nil; + __block SDLWindowCapability *windowCapability = nil; beforeEach(^{ resultError = nil; @@ -58,9 +59,10 @@ describe(@"present choice operation", ^{ testChoices = @[cell1]; testChoiceSet = [[SDLChoiceSet alloc] initWithTitle:@"Test Title" delegate:testChoiceDelegate layout:SDLChoiceSetLayoutTiles timeout:13 initialPromptString:@"Test initial prompt" timeoutPromptString:@"Test timeout prompt" helpPromptString:@"Test help prompt" vrHelpList:nil choices:testChoices]; + windowCapability = [[SDLWindowCapability alloc] init]; testKeyboardDelegate = OCMProtocolMock(@protocol(SDLKeyboardDelegate)); OCMStub([testKeyboardDelegate customKeyboardConfiguration]).andReturn(nil); - testKeyboardProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; + testKeyboardProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil maskInputCharacters:nil customKeys:nil]; }); it(@"should have a priority of 'normal'", ^{ @@ -71,7 +73,7 @@ describe(@"present choice operation", ^{ describe(@"running a non-searchable choice set operation", ^{ beforeEach(^{ - testOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:nil keyboardDelegate:nil cancelID:testCancelID]; + testOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:nil keyboardDelegate:nil cancelID:testCancelID windowCapability:windowCapability]; testOp.completionBlock = ^{ hasCalledOperationCompletionHandler = YES; }; @@ -125,7 +127,7 @@ describe(@"present choice operation", ^{ __block SDLPresentChoiceSetOperation *testCancelOp = nil; beforeEach(^{ - testCancelOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:nil keyboardDelegate:nil cancelID:testCancelID]; + testCancelOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:nil keyboardDelegate:nil cancelID:testCancelID windowCapability:windowCapability]; testCancelOp.completionBlock = ^{ hasCalledOperationCompletionHandler = YES; }; @@ -313,7 +315,7 @@ describe(@"present choice operation", ^{ describe(@"running a searchable choice set operation", ^{ beforeEach(^{ - testOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:testKeyboardProperties keyboardDelegate:testKeyboardDelegate cancelID:testCancelID]; + testOp = [[SDLPresentChoiceSetOperation alloc] initWithConnectionManager:testConnectionManager choiceSet:testChoiceSet mode:testInteractionMode keyboardProperties:testKeyboardProperties keyboardDelegate:testKeyboardDelegate cancelID:testCancelID windowCapability:windowCapability]; testOp.completionBlock = ^{ hasCalledOperationCompletionHandler = YES; @@ -414,6 +416,25 @@ describe(@"present choice operation", ^{ }]]); }); + it(@"should respond to enabled keyboard event", ^{ + SDLRPCNotificationNotification *notification = nil; + + // Submit notification + SDLOnKeyboardInput *input = [[SDLOnKeyboardInput alloc] init]; + input.event = SDLKeyboardEventInputKeyMaskEnabled; + notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveKeyboardInputNotification object:nil rpcNotification:input]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + + OCMVerify([testKeyboardDelegate keyboardDidSendEvent:[OCMArg checkWithBlock:^BOOL(id obj) { + return [(SDLKeyboardEvent)obj isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + }] text:[OCMArg isNil]]); + + OCMVerify([testKeyboardDelegate keyboardDidUpdateInputMask:[OCMArg checkWithBlock:^BOOL(id obj) { + return [(SDLKeyboardEvent)obj isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + }]]); + }); + it(@"should respond to cancellation notifications", ^{ SDLRPCNotificationNotification *notification = nil; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m index 29ed6d0b0..389e0367d 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m @@ -33,6 +33,7 @@ describe(@"present keyboard operation", ^{ __block BOOL hasCalledOperationCompletionHandler = NO; __block NSError *resultError = nil; + __block SDLWindowCapability *windowCapability = nil; beforeEach(^{ testOp = nil; @@ -43,7 +44,17 @@ describe(@"present keyboard operation", ^{ testDelegate = OCMProtocolMock(@protocol(SDLKeyboardDelegate)); OCMStub([testDelegate customKeyboardConfiguration]).andReturn(nil); - testInitialProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; + windowCapability = [[SDLWindowCapability alloc] init]; + testInitialProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil maskInputCharacters:nil customKeys:nil]; + }); + + afterEach(^{ + if (testOp) { + // rationale: every test run creates a new operation to test, the old operation from a previous test + // stays 'undead' undefined time and can receive notifications causing a test fail at random + [[NSNotificationCenter defaultCenter] removeObserver:testOp]; + testOp = nil; + } }); it(@"should have a priority of 'normal'", ^{ @@ -54,7 +65,7 @@ describe(@"present keyboard operation", ^{ describe(@"running the operation", ^{ beforeEach(^{ - testOp = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:testConnectionManager keyboardProperties:testInitialProperties initialText:testInitialText keyboardDelegate:testDelegate cancelID:testCancelID]; + testOp = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:testConnectionManager keyboardProperties:testInitialProperties initialText:testInitialText keyboardDelegate:testDelegate cancelID:testCancelID windowCapability:windowCapability]; testOp.completionBlock = ^{ hasCalledOperationCompletionHandler = YES; }; @@ -148,6 +159,25 @@ describe(@"present keyboard operation", ^{ }]]); }); + it(@"should respond to enabled keyboard event", ^{ + SDLRPCNotificationNotification *notification = nil; + + // Submit notification + SDLOnKeyboardInput *input = [[SDLOnKeyboardInput alloc] init]; + input.event = SDLKeyboardEventInputKeyMaskEnabled; + notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveKeyboardInputNotification object:nil rpcNotification:input]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + + OCMVerify([testDelegate keyboardDidSendEvent:[OCMArg checkWithBlock:^BOOL(id obj) { + return [(SDLKeyboardEvent)obj isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + }] text:[OCMArg isNil]]); + + OCMVerify([testDelegate keyboardDidUpdateInputMask:[OCMArg checkWithBlock:^BOOL(id obj) { + return [(SDLKeyboardEvent)obj isEqualToEnum:SDLKeyboardEventInputKeyMaskEnabled]; + }]]); + }); + it(@"should respond to cancellation notifications", ^{ SDLRPCNotificationNotification *notification = nil; @@ -260,7 +290,7 @@ describe(@"present keyboard operation", ^{ describe(@"Canceling the keyboard", ^{ beforeEach(^{ - testOp = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:testConnectionManager keyboardProperties:testInitialProperties initialText:testInitialText keyboardDelegate:testDelegate cancelID:testCancelID]; + testOp = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:testConnectionManager keyboardProperties:testInitialProperties initialText:testInitialText keyboardDelegate:testDelegate cancelID:testCancelID windowCapability:windowCapability]; testOp.completionBlock = ^{ hasCalledOperationCompletionHandler = YES; }; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m index 41ff4ba56..c3e95144a 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLTextAndGraphicManagerSpec.m @@ -489,7 +489,7 @@ describe(@"text and graphic manager", ^{ beforeEach(^{ testHMIStatus = [[SDLOnHMIStatus alloc] init]; - testWindowCapability = [[SDLWindowCapability alloc] initWithWindowID:@(SDLPredefinedWindowsDefaultWindow) textFields:nil imageFields:nil imageTypeSupported:nil templatesAvailable:nil numCustomPresetsAvailable:nil buttonCapabilities:nil softButtonCapabilities:nil menuLayoutsAvailable:nil dynamicUpdateCapabilities:nil]; + testWindowCapability = [[SDLWindowCapability alloc] initWithWindowID:@(SDLPredefinedWindowsDefaultWindow) textFields:nil imageFields:nil imageTypeSupported:nil templatesAvailable:nil numCustomPresetsAvailable:nil buttonCapabilities:nil softButtonCapabilities:nil menuLayoutsAvailable:nil dynamicUpdateCapabilities:nil keyboardCapabilities:nil]; testDisplayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"Test display" windowCapabilities:@[testWindowCapability] windowTypeSupported:nil]; testSystemCapability = [[SDLSystemCapability alloc] initWithDisplayCapabilities:@[testDisplayCapability]]; @@ -554,7 +554,7 @@ describe(@"text and graphic manager", ^{ SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangeHMIStatusNotification object:nil rpcNotification:testHMIStatus]; [[NSNotificationCenter defaultCenter] postNotification:notification]; - testWindowCapability = [[SDLWindowCapability alloc] initWithWindowID:@(SDLPredefinedWindowsDefaultWindow) textFields:nil imageFields:nil imageTypeSupported:nil templatesAvailable:nil numCustomPresetsAvailable:nil buttonCapabilities:nil softButtonCapabilities:nil menuLayoutsAvailable:nil dynamicUpdateCapabilities:nil]; + testWindowCapability = [[SDLWindowCapability alloc] initWithWindowID:@(SDLPredefinedWindowsDefaultWindow) textFields:nil imageFields:nil imageTypeSupported:nil templatesAvailable:nil numCustomPresetsAvailable:nil buttonCapabilities:nil softButtonCapabilities:nil menuLayoutsAvailable:nil dynamicUpdateCapabilities:nil keyboardCapabilities:nil]; testDisplayCapability = [[SDLDisplayCapability alloc] initWithDisplayName:@"Test display" windowCapabilities:@[testWindowCapability] windowTypeSupported:nil]; testSystemCapability = [[SDLSystemCapability alloc] initWithDisplayCapabilities:@[testDisplayCapability]]; }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardEventSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardEventSpec.m index ce2782d3f..d47e87d4c 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardEventSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardEventSpec.m @@ -12,13 +12,15 @@ QuickSpecBegin(SDLKeyboardEventSpec) -describe(@"Individual Enum Value Tests", ^ { - it(@"Should match internal values", ^ { +describe(@"individual enum value tests", ^{ + it(@"should match internal values", ^{ expect(SDLKeyboardEventKeypress).to(equal(@"KEYPRESS")); expect(SDLKeyboardEventSubmitted).to(equal(@"ENTRY_SUBMITTED")); expect(SDLKeyboardEventCancelled).to(equal(@"ENTRY_CANCELLED")); expect(SDLKeyboardEventAborted).to(equal(@"ENTRY_ABORTED")); expect(SDLKeyboardEventVoice).to(equal(@"ENTRY_VOICE")); + expect(SDLKeyboardEventInputKeyMaskEnabled).to(equal(@"INPUT_KEY_MASK_ENABLED")); + expect(SDLKeyboardEventInputKeyMaskDisabled).to(equal(@"INPUT_KEY_MASK_DISABLED")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m new file mode 100644 index 000000000..dd7bd708e --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardInputMaskSpec.m @@ -0,0 +1,23 @@ +// +// SDLAppHMITypeSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardInputMask.h" + +QuickSpecBegin(SDLKeyboardInputMaskSpec) + +describe(@"individual enum value tests", ^{ + it(@"should match internal values", ^{ + expect(SDLKeyboardInputMaskEnableInputKeyMask).to(equal(@"ENABLE_INPUT_KEY_MASK")); + expect(SDLKeyboardInputMaskDisableInputKeyMask).to(equal(@"DISABLE_INPUT_KEY_MASK")); + expect(SDLKeyboardInputMaskUserChoiceInputKeyMask).to(equal(@"USER_CHOICE_INPUT_KEY_MASK")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardLayoutSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardLayoutSpec.m index ec0298852..d254c9d06 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardLayoutSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLKeyboardLayoutSpec.m @@ -12,11 +12,12 @@ QuickSpecBegin(SDLKeyboardLayoutSpec) -describe(@"Individual Enum Value Tests", ^ { - it(@"Should match internal values", ^ { +describe(@"individual enum value tests", ^{ + it(@"should match internal values", ^{ expect(SDLKeyboardLayoutQWERTY).to(equal(@"QWERTY")); expect(SDLKeyboardLayoutQWERTZ).to(equal(@"QWERTZ")); expect(SDLKeyboardLayoutAZERTY).to(equal(@"AZERTY")); + expect(SDLKeyboardLayoutNumeric).to(equal(@"NUMERIC")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m new file mode 100644 index 000000000..18abde7e6 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardCapabilitiesSpec.m @@ -0,0 +1,75 @@ +// +// SDLKeyboardCapabilitiesSpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardCapabilities.h" +#import "SDLRPCParameterNames.h" +#import "SDLKeyboardLayoutCapability.h" + +QuickSpecBegin(SDLKeyboardCapabilitiesSpec) + +NSNumber *maskInputCharactersSupported = @YES; +SDLKeyboardLayoutCapability *keyboardLayoutCapability = [[SDLKeyboardLayoutCapability alloc] init]; +NSArray<SDLKeyboardLayoutCapability *> *supportedKeyboards = @[keyboardLayoutCapability]; +__block SDLKeyboardCapabilities* testStruct = nil; + +describe(@"getter/setter tests", ^{ + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] init]; + }); + + it(@"should return nil if not set", ^{ + expect(testStruct.maskInputCharactersSupported).to(beNil()); + expect(testStruct.supportedKeyboards).to(beNil()); + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] init]; + testStruct.maskInputCharactersSupported = maskInputCharactersSupported; + testStruct.supportedKeyboards = supportedKeyboards; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); + + context(@"initWithDictionary:", ^{ + beforeEach(^{ + NSDictionary<NSString *, id> *dict = @{ + SDLRPCParameterNameMaskInputCharactersSupported: maskInputCharactersSupported, + SDLRPCParameterNameSupportedKeyboards: supportedKeyboards, + }; + testStruct = [[SDLKeyboardCapabilities alloc] initWithDictionary:dict]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); + + context(@"initWithMaskInputCharactersSupported:supportedKeyboards:", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardCapabilities alloc] initWithMaskInputCharactersSupported:maskInputCharactersSupported supportedKeyboards:supportedKeyboards]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct).notTo(beNil()); + expect(testStruct.maskInputCharactersSupported).to(equal(maskInputCharactersSupported)); + expect(testStruct.supportedKeyboards).to(equal(supportedKeyboards)); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m new file mode 100644 index 000000000..f938c30a9 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardLayoutCapabilitySpec.m @@ -0,0 +1,75 @@ +// +// SDLKeyboardLayoutCapabilitySpec.m +// SmartDeviceLink + + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayout.h" +#import "SDLRPCParameterNames.h" +#import "SDLKeyboardLayoutCapability.h" + +QuickSpecBegin(SDLKeyboardLayoutCapabilitySpec) + +SDLKeyboardLayout keyboardLayout = SDLKeyboardLayoutNumeric; +UInt8 numConfigurableKeys = 9; +__block SDLKeyboardLayoutCapability* testStruct = nil; + +describe(@"getter/setter tests", ^{ + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] init]; + }); + + it(@"should return nil if not set", ^{ + expect(testStruct.keyboardLayout).to(beNil()); + expect(testStruct.numConfigurableKeys).to(beNil()); + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] init]; + testStruct.numConfigurableKeys = @(numConfigurableKeys); + testStruct.keyboardLayout = keyboardLayout; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); + + context(@"initWithDictionary:", ^{ + beforeEach(^{ + NSDictionary<NSString *, id> *dict = @{ + SDLRPCParameterNameNumConfigurableKeys: @(numConfigurableKeys), + SDLRPCParameterNameKeyboardLayout: keyboardLayout, + }; + testStruct = [[SDLKeyboardLayoutCapability alloc] initWithDictionary:dict]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); + + context(@"initWithKeyboardLayout:numConfigurableKeys:", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardLayoutCapability alloc] initWithKeyboardLayout:keyboardLayout numConfigurableKeys:numConfigurableKeys]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct).notTo(beNil()); + expect(testStruct.numConfigurableKeys).to(equal(@(numConfigurableKeys))); + expect(testStruct.keyboardLayout).to(equal(keyboardLayout)); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m index b1f15a63f..8735babca 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m @@ -8,109 +8,182 @@ #import <Quick/Quick.h> #import <Nimble/Nimble.h> +#import "SDLKeyboardInputMask.h" #import "SDLKeyboardLayout.h" #import "SDLKeypressMode.h" #import "SDLKeyboardProperties.h" #import "SDLLanguage.h" #import "SDLRPCParameterNames.h" - QuickSpecBegin(SDLKeyboardPropertiesSpec) -describe(@"Getter/Setter Tests", ^ { - __block SDLLanguage testLanguage = SDLLanguageDaDk; - __block SDLKeyboardLayout testLayout = SDLKeyboardLayoutAZERTY; - __block SDLKeypressMode testMode = SDLKeypressModeSingleKeypress; - __block NSArray<NSString *> *testLimitedCharacterList = @[@"s", @"r", @"f"]; - __block NSString *testAutoCompleteText = @"Auto Carrot"; - __block NSArray<NSString *> *testAutoCompleteList = @[@"Hello World", @"How are you"]; - - it(@"Should set and get correctly", ^ { - SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init]; - - testStruct.language = testLanguage; - testStruct.keyboardLayout = testLayout; - testStruct.keypressMode = testMode; - testStruct.limitedCharacterList = testLimitedCharacterList; - testStruct.autoCompleteList = testAutoCompleteList; +__block SDLLanguage testLanguage = nil; +__block SDLKeyboardLayout testLayout = nil; +__block SDLKeypressMode testMode = nil; +__block NSArray<NSString *> *testLimitedCharacterList = nil; +__block NSString *testAutoCompleteText = nil; +__block NSArray<NSString *> *testAutoCompleteList = nil; +__block SDLKeyboardInputMask maskInputCharacters = nil; +__block NSArray<NSString *> *customKeys = nil; +__block SDLKeyboardProperties* testStruct = nil; + +describe(@"getter/setter tests", ^{ + beforeEach(^{ + testLanguage = SDLLanguageDaDk; + testLayout = SDLKeyboardLayoutAZERTY; + testMode = SDLKeypressModeSingleKeypress; + testLimitedCharacterList = @[@"s", @"r", @"f"]; + testAutoCompleteText = @"Auto Carrot"; + testAutoCompleteList = @[@"Hello World", @"How are you"]; + maskInputCharacters = SDLKeyboardInputMaskEnableInputKeyMask; + customKeys = @[@"abc", @"DEF"]; + }); + + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardProperties alloc] init]; + }); + + it(@"expect all properties to be nil", ^{ + expect(testStruct.language).to(beNil()); + expect(testStruct.keyboardLayout).to(beNil()); + expect(testStruct.keypressMode).to(beNil()); + expect(testStruct.limitedCharacterList).to(beNil()); + expect(testStruct.autoCompleteList).to(beNil()); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.autoCompleteText).to(beNil()); +#pragma clang diagnostic pop + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardProperties alloc] init]; + testStruct.language = testLanguage; + testStruct.keyboardLayout = testLayout; + testStruct.keypressMode = testMode; + testStruct.limitedCharacterList = testLimitedCharacterList; + testStruct.autoCompleteList = testAutoCompleteList; + testStruct.maskInputCharacters = maskInputCharacters; + testStruct.customKeys = customKeys; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - testStruct.autoCompleteText = testAutoCompleteText; + testStruct.autoCompleteText = testAutoCompleteText; #pragma clang diagnostic pop + testStruct.maskInputCharacters = maskInputCharacters; + }); - expect(testStruct.language).to(equal(testLanguage)); - expect(testStruct.keyboardLayout).to(equal(testLayout)); - expect(testStruct.keypressMode).to(equal(testMode)); - expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + it(@"should be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); + expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop + }); }); - - it(@"Should get correctly when initialized with a dictionary", ^ { - NSDictionary* dict = @{SDLRPCParameterNameLanguage: testLanguage, - SDLRPCParameterNameKeyboardLayout: testLayout, - SDLRPCParameterNameKeypressMode: testMode, - SDLRPCParameterNameLimitedCharacterList: testLimitedCharacterList, - SDLRPCParameterNameAutoCompleteList: testAutoCompleteList, - SDLRPCParameterNameAutoCompleteText: testAutoCompleteText - }; - SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] initWithDictionary:dict]; - - expect(testStruct.language).to(equal(testLanguage)); - expect(testStruct.keyboardLayout).to(equal(testLayout)); - expect(testStruct.keypressMode).to(equal(testMode)); - expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + + context(@"initWithDictionary:", ^{ + beforeEach(^{ + NSDictionary* dict = @{SDLRPCParameterNameLanguage: testLanguage, + SDLRPCParameterNameKeyboardLayout: testLayout, + SDLRPCParameterNameKeypressMode: testMode, + SDLRPCParameterNameLimitedCharacterList: testLimitedCharacterList, + SDLRPCParameterNameAutoCompleteList: testAutoCompleteList, + SDLRPCParameterNameAutoCompleteText: testAutoCompleteText, + SDLRPCParameterNameMaskInputCharacters: maskInputCharacters, + SDLRPCParameterNameCustomKeys: customKeys, + }; + testStruct = [[SDLKeyboardProperties alloc] initWithDictionary:dict]; + }); + + it(@"should be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); + expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop + }); }); - it(@"Should get correctly when initialized with initWithLanguage:layout:keypressMode:limitedCharacterList:autoCompleteText:autoCompleteList:", ^ { + context(@"initWithLanguage:layout:keypressMode:limitedCharacterList:autoCompleteText:autoCompleteList:", ^{ + beforeEach(^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage layout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteText:testAutoCompleteText autoCompleteList:testAutoCompleteList]; + testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage layout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteText:testAutoCompleteText autoCompleteList:testAutoCompleteList]; #pragma clang diagnostic pop - expect(testStruct.language).to(equal(testLanguage)); - expect(testStruct.keyboardLayout).to(equal(testLayout)); - expect(testStruct.keypressMode).to(equal(testMode)); - expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + }); + + it(@"should be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); + expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop - expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + }); }); - it(@"Should get correctly when initialized with initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:", ^ { - SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList]; - expect(testStruct.language).to(equal(testLanguage)); - expect(testStruct.keyboardLayout).to(equal(testLayout)); - expect(testStruct.keypressMode).to(equal(testMode)); - expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + context(@"initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:", ^{ + beforeEach(^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(beNil()); + testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList]; #pragma clang diagnostic pop + }); + + it(@"should be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(beNil()); + expect(testStruct.customKeys).to(beNil()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.autoCompleteText).to(beNil()); +#pragma clang diagnostic pop + }); }); - - it(@"Should return nil if not set", ^ { - SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] init]; - - expect(testStruct.language).to(beNil()); - expect(testStruct.keyboardLayout).to(beNil()); - expect(testStruct.keypressMode).to(beNil()); - expect(testStruct.limitedCharacterList).to(beNil()); - expect(testStruct.autoCompleteList).to(beNil()); + + context(@"initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:maskInputCharacters:customKeys:", ^{ + beforeEach(^{ + testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList maskInputCharacters:maskInputCharacters customKeys:customKeys]; + }); + + it(@"should be set properly", ^{ + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + expect(testStruct.maskInputCharacters).to(equal(maskInputCharacters)); + expect(testStruct.customKeys).to(equal(customKeys)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(beNil()); + expect(testStruct.autoCompleteText).to(beNil()); #pragma clang diagnostic pop + }); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowCapabilitySpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowCapabilitySpec.m index e8c2514b4..ee5d34ef5 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowCapabilitySpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowCapabilitySpec.m @@ -5,16 +5,18 @@ #import <Quick/Quick.h> #import <Nimble/Nimble.h> -#import "SDLWindowCapability.h" - #import "SDLButtonCapabilities.h" #import "SDLDynamicUpdateCapabilities.h" #import "SDLImageField.h" #import "SDLImageType.h" +#import "SDLKeyboardCapabilities.h" +#import "SDLKeyboardLayoutCapability.h" +#import "SDLKeyboardProperties.h" #import "SDLRPCParameterNames.h" #import "SDLSoftButtonCapabilities.h" #import "SDLTextField.h" #import "SDLTextFieldName.h" +#import "SDLWindowCapability+ScreenManagerExtensions.h" QuickSpecBegin(SDLWindowCapabilitySpec) @@ -30,89 +32,253 @@ __block NSString *testImageName = nil; __block NSString *testTemplateAvailable = nil; __block SDLMenuLayout testMenuLayout = SDLMenuLayoutTiles; __block SDLDynamicUpdateCapabilities *testDynamicUpdates = nil; +__block NSArray<SDLTextField *> *textFields = nil; +__block NSArray<SDLImageField *> *imageFields = nil; +__block NSArray<SDLButtonCapabilities *> *buttonCapabilities = nil; +__block SDLKeyboardCapabilities *keyboardCapabilities = nil; +__block id windowID = nil; +__block id numCustomPresetsAvailable = nil; +__block NSArray<SDLImageType> *imageTypeSupported = nil; +__block NSArray<NSString *> *templatesAvailable = nil; +__block NSArray<SDLSoftButtonCapabilities *> *softButtonCapabilities = nil; +__block NSArray<SDLMenuLayout> *menuLayoutsAvailable = nil; -describe(@"Getter/Setter Tests", ^ { +describe(@"getter/setter tests", ^{ beforeEach(^{ testImageType = SDLImageTypeDynamic; testTextName = @"test Text field"; testImageName = @"test Image field"; - + testTextField = [[SDLTextField alloc] init]; testTextField.name = SDLTextFieldNameTertiaryText; testImageField = [[SDLImageField alloc] init]; testImageField.name = testImageName; - + testButtonCapabilities = [[SDLButtonCapabilities alloc] init]; testButtonCapabilities.name = SDLButtonNameOk; testButtonCapabilities.shortPressAvailable = @YES; testButtonCapabilities.longPressAvailable = @YES; testButtonCapabilities.upDownAvailable = @YES; - + testSoftButtonsCapabilities = [[SDLSoftButtonCapabilities alloc] init]; testSoftButtonsCapabilities.imageSupported = @YES; testTemplateAvailable = @"myTemplate"; testDynamicUpdates = [[SDLDynamicUpdateCapabilities alloc] initWithSupportedDynamicImageFieldNames:@[SDLImageFieldNameSubMenuIcon] supportsDynamicSubMenus:@YES]; + + textFields = @[testTextField]; + imageFields = @[testImageField]; + buttonCapabilities = @[testButtonCapabilities]; + keyboardCapabilities = [[SDLKeyboardCapabilities alloc] init]; + windowID = @444; + numCustomPresetsAvailable = @10; + imageTypeSupported = @[testImageType]; + templatesAvailable = @[testTemplateAvailable]; + softButtonCapabilities = @[testSoftButtonsCapabilities]; + menuLayoutsAvailable = @[testMenuLayout]; }); - - it(@"Should set and get correctly", ^ { - testStruct = [[SDLWindowCapability alloc] init]; - testStruct.windowID = @444; - testStruct.numCustomPresetsAvailable = @10; - testStruct.textFields = @[testTextField]; - testStruct.imageFields = @[testImageField]; - testStruct.imageTypeSupported = @[testImageType]; - testStruct.buttonCapabilities = @[testButtonCapabilities]; - testStruct.softButtonCapabilities = @[testSoftButtonsCapabilities]; - testStruct.menuLayoutsAvailable = @[testMenuLayout]; - testStruct.templatesAvailable = @[testTemplateAvailable]; - testStruct.dynamicUpdateCapabilities = testDynamicUpdates; - - expect(testStruct.windowID).to(equal(@444)); - expect(testStruct.textFields.firstObject.name).to(equal(SDLTextFieldNameTertiaryText)); - expect(testStruct.imageFields.firstObject.name).to(equal(testImageName)); - expect(testStruct.numCustomPresetsAvailable).to(equal(@10)); - expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); - expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(equal(@YES)); - expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(equal(@YES)); - expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); - expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(equal(@YES)); - expect(testStruct.menuLayoutsAvailable).to(equal(@[testMenuLayout])); - expect(testStruct.templatesAvailable).to(equal(@[testTemplateAvailable])); - expect(testStruct.dynamicUpdateCapabilities).to(equal(testDynamicUpdates)); + + context(@"init", ^{ + beforeEach(^{ + testStruct = [[SDLWindowCapability alloc] init]; + }); + + it(@"expect all properties to be nil", ^{ + expect(testStruct.windowID).to(beNil()); + expect(testStruct.textFields.firstObject.name).to(beNil()); + expect(testStruct.imageFields.firstObject.name).to(beNil()); + expect(testStruct.numCustomPresetsAvailable).to(beNil()); + expect(testStruct.buttonCapabilities.firstObject.name).to(beNil()); + expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(beNil()); + expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(beNil()); + expect(testStruct.buttonCapabilities.firstObject.name).to(beNil()); + expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(beNil()); + expect(testStruct.menuLayoutsAvailable).to(beNil()); + expect(testStruct.templatesAvailable).to(beNil()); + expect(testStruct.dynamicUpdateCapabilities).to(beNil()); + expect(testStruct.imageTypeSupported).to(beNil()); + expect(testStruct.keyboardCapabilities).to(beNil()); + }); + }); + + context(@"init and assign", ^{ + beforeEach(^{ + testStruct = [[SDLWindowCapability alloc] init]; + testStruct.windowID = windowID; + testStruct.numCustomPresetsAvailable = numCustomPresetsAvailable; + testStruct.textFields = @[testTextField]; + testStruct.imageFields = @[testImageField]; + testStruct.imageTypeSupported = @[testImageType]; + testStruct.buttonCapabilities = @[testButtonCapabilities]; + testStruct.softButtonCapabilities = @[testSoftButtonsCapabilities]; + testStruct.menuLayoutsAvailable = @[testMenuLayout]; + testStruct.templatesAvailable = @[testTemplateAvailable]; + testStruct.dynamicUpdateCapabilities = testDynamicUpdates; + testStruct.keyboardCapabilities = keyboardCapabilities; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.windowID).to(equal(windowID)); + expect(testStruct.textFields.firstObject.name).to(equal(SDLTextFieldNameTertiaryText)); + expect(testStruct.imageFields.firstObject.name).to(equal(testImageName)); + expect(testStruct.numCustomPresetsAvailable).to(equal(numCustomPresetsAvailable)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(equal(@YES)); + expect(testStruct.menuLayoutsAvailable).to(equal(@[testMenuLayout])); + expect(testStruct.templatesAvailable).to(equal(@[testTemplateAvailable])); + expect(testStruct.dynamicUpdateCapabilities).to(equal(testDynamicUpdates)); + expect(testStruct.imageTypeSupported).to(equal(@[testImageType])); + expect(testStruct.keyboardCapabilities).to(equal(keyboardCapabilities)); + }); + }); + + context(@"initWithWindowID:textFields:imageFields:imageTypeSupported:templatesAvailable:numCustomPresetsAvailable:buttonCapabilities:softButtonCapabilities:menuLayoutsAvailable:dynamicUpdateCapabilities:", ^{ + beforeEach(^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + testStruct = [[SDLWindowCapability alloc] initWithWindowID:windowID textFields:textFields imageFields:imageFields imageTypeSupported:imageTypeSupported templatesAvailable:templatesAvailable numCustomPresetsAvailable:numCustomPresetsAvailable buttonCapabilities:buttonCapabilities softButtonCapabilities:softButtonCapabilities menuLayoutsAvailable:menuLayoutsAvailable dynamicUpdateCapabilities:testDynamicUpdates]; +#pragma clang diagnostic pop + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.windowID).to(equal(windowID)); + expect(testStruct.textFields.firstObject.name).to(equal(SDLTextFieldNameTertiaryText)); + expect(testStruct.imageFields.firstObject.name).to(equal(testImageName)); + expect(testStruct.numCustomPresetsAvailable).to(equal(numCustomPresetsAvailable)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(equal(@YES)); + expect(testStruct.menuLayoutsAvailable).to(equal(@[testMenuLayout])); + expect(testStruct.templatesAvailable).to(equal(@[testTemplateAvailable])); + expect(testStruct.dynamicUpdateCapabilities).to(equal(testDynamicUpdates)); + expect(testStruct.imageTypeSupported).to(equal(@[testImageType])); + expect(testStruct.keyboardCapabilities).to(beNil()); + }); + }); + + context(@"initWithWindowID:textFields:imageFields:imageTypeSupported:templatesAvailable:numCustomPresetsAvailable:buttonCapabilities:softButtonCapabilities:menuLayoutsAvailable:dynamicUpdateCapabilities:keyboardCapabilities:", ^{ + beforeEach(^{ + testStruct = [[SDLWindowCapability alloc] initWithWindowID:windowID textFields:textFields imageFields:imageFields imageTypeSupported:imageTypeSupported templatesAvailable:templatesAvailable numCustomPresetsAvailable:numCustomPresetsAvailable buttonCapabilities:buttonCapabilities softButtonCapabilities:softButtonCapabilities menuLayoutsAvailable:menuLayoutsAvailable dynamicUpdateCapabilities:testDynamicUpdates keyboardCapabilities:keyboardCapabilities]; + }); + + it(@"expect all properties to be set properly", ^{ + expect(testStruct.windowID).to(equal(windowID)); + expect(testStruct.textFields.firstObject.name).to(equal(SDLTextFieldNameTertiaryText)); + expect(testStruct.imageFields.firstObject.name).to(equal(testImageName)); + expect(testStruct.numCustomPresetsAvailable).to(equal(numCustomPresetsAvailable)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(equal(@YES)); + expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); + expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(equal(@YES)); + expect(testStruct.menuLayoutsAvailable).to(equal(@[testMenuLayout])); + expect(testStruct.templatesAvailable).to(equal(@[testTemplateAvailable])); + expect(testStruct.dynamicUpdateCapabilities).to(equal(testDynamicUpdates)); + expect(testStruct.imageTypeSupported).to(equal(@[testImageType])); + expect(testStruct.keyboardCapabilities).to(equal(keyboardCapabilities)); + }); }); }); -describe(@"initializing with ", ^{ +describe(@"creating a valid keyboard configuration based on keyboard capabilities", ^{ + UInt8 numConfigurableKeys = 7; + beforeEach(^{ - testStruct = [[SDLWindowCapability alloc] initWithWindowID:@444 textFields:@[testTextField] imageFields:@[testImageField] imageTypeSupported:@[testImageType] templatesAvailable:@[testTemplateAvailable] numCustomPresetsAvailable:@10 buttonCapabilities:@[testButtonCapabilities] softButtonCapabilities:@[testSoftButtonsCapabilities] menuLayoutsAvailable:@[testMenuLayout] dynamicUpdateCapabilities:testDynamicUpdates]; + testStruct = [[SDLWindowCapability alloc] init]; + testStruct.keyboardCapabilities = nil; }); - it(@"Should set and get correctly", ^ { - testStruct = [[SDLWindowCapability alloc] init]; - testStruct.windowID = @444; - testStruct.numCustomPresetsAvailable = @10; - testStruct.textFields = @[testTextField]; - testStruct.imageFields = @[testImageField]; - testStruct.imageTypeSupported = @[testImageType]; - testStruct.buttonCapabilities = @[testButtonCapabilities]; - testStruct.softButtonCapabilities = @[testSoftButtonsCapabilities]; - testStruct.menuLayoutsAvailable = @[testMenuLayout]; - testStruct.templatesAvailable = @[testTemplateAvailable]; - testStruct.dynamicUpdateCapabilities = testDynamicUpdates; - - expect(testStruct.windowID).to(equal(@444)); - expect(testStruct.textFields.firstObject.name).to(equal(SDLTextFieldNameTertiaryText)); - expect(testStruct.imageFields.firstObject.name).to(equal(testImageName)); - expect(testStruct.numCustomPresetsAvailable).to(equal(@10)); - expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); - expect(testStruct.buttonCapabilities.firstObject.shortPressAvailable).to(equal(@YES)); - expect(testStruct.buttonCapabilities.firstObject.longPressAvailable).to(equal(@YES)); - expect(testStruct.buttonCapabilities.firstObject.name).to(equal(SDLButtonNameOk)); - expect(testStruct.softButtonCapabilities.firstObject.imageSupported).to(equal(@YES)); - expect(testStruct.menuLayoutsAvailable).to(equal(@[testMenuLayout])); - expect(testStruct.templatesAvailable).to(equal(@[testTemplateAvailable])); - expect(testStruct.dynamicUpdateCapabilities).to(equal(testDynamicUpdates)); + context(@"when keyboardCapabilities is nil or empty", ^{ + it(@"result should be nil when the argument is nil", ^{ + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:nil]; + expect(resultProperties).to(beNil()); + }); + + it(@"result should be equal to the argument when keyboardLayout is nil", ^{ + SDLKeyboardProperties *testKeyboardProperties = [[SDLKeyboardProperties alloc] init]; + testKeyboardProperties.maskInputCharacters = SDLKeyboardInputMaskUserChoiceInputKeyMask; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).notTo(beNil()); + expect(resultProperties).to(equal(testKeyboardProperties)); + expect(resultProperties.maskInputCharacters).to(equal(SDLKeyboardInputMaskUserChoiceInputKeyMask)); + }); + + it(@"result should be nil when the argument is not nil and keyboardCapabilities is empty", ^{ + testStruct.keyboardCapabilities = [[SDLKeyboardCapabilities alloc] init]; + SDLKeyboardProperties *testKeyboardProperties = [[SDLKeyboardProperties alloc] init]; + testKeyboardProperties.keyboardLayout = SDLKeyboardLayoutNumeric; + testKeyboardProperties.maskInputCharacters = SDLKeyboardInputMaskUserChoiceInputKeyMask; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).to(beNil()); + }); + + context(@"when keyboardCapabilities is not empty", ^{ + __block SDLKeyboardProperties *testKeyboardProperties = nil; + __block SDLKeyboardCapabilities *keyboardCapabilities = nil; + __block NSArray *testCustomKeysLong = nil; + + beforeEach(^{ + // create a long array that contains more custom keys than <numConfigurableKeys> + testCustomKeysLong = [@"a ä æ b c d e ê f j h i j k l m n o p q r s ß t u v w x y z" componentsSeparatedByString:@" "]; + NSArray *arrayLayouts = @[SDLKeyboardLayoutQWERTY, SDLKeyboardLayoutQWERTZ, SDLKeyboardLayoutAZERTY, SDLKeyboardLayoutNumeric]; + NSMutableArray *arrayLayoutCapability = [[NSMutableArray alloc] initWithCapacity:arrayLayouts.count]; + for (SDLKeyboardLayout layout in arrayLayouts) { + SDLKeyboardLayoutCapability *layoutCapability = [[SDLKeyboardLayoutCapability alloc] initWithKeyboardLayout:layout numConfigurableKeys:numConfigurableKeys]; + [arrayLayoutCapability addObject:layoutCapability]; + } + keyboardCapabilities = [[SDLKeyboardCapabilities alloc] init]; + keyboardCapabilities.supportedKeyboards = arrayLayoutCapability; + testStruct.keyboardCapabilities = keyboardCapabilities; + + testKeyboardProperties = [[SDLKeyboardProperties alloc] init]; + testKeyboardProperties.keyboardLayout = SDLKeyboardLayoutNumeric; + // create custom keys array longer than <numConfigurableKeys> + testKeyboardProperties.customKeys = testCustomKeysLong; + testKeyboardProperties.maskInputCharacters = SDLKeyboardInputMaskUserChoiceInputKeyMask; + testKeyboardProperties.keyboardLayout = SDLKeyboardLayoutAZERTY; + }); + + it(@"maskInputCharacters should not be nil when maskInputCharactersSupported = YES", ^{ + keyboardCapabilities.maskInputCharactersSupported = @YES; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).notTo(beNil()); + expect(resultProperties).notTo(equal(testKeyboardProperties)); + expect(resultProperties.customKeys.count).to(equal(numConfigurableKeys)); + expect(resultProperties.maskInputCharacters).to(equal(SDLKeyboardInputMaskUserChoiceInputKeyMask)); + }); + + it(@"maskInputCharacters should be nil when maskInputCharactersSupported = NO", ^{ + keyboardCapabilities.maskInputCharactersSupported = @NO; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).notTo(beNil()); + expect(resultProperties).notTo(equal(testKeyboardProperties)); + expect(resultProperties.customKeys.count).to(equal(numConfigurableKeys)); + expect(resultProperties.maskInputCharacters).to(beNil()); + }); + + it(@"customKeys should be trimmed to contain <numConfigurableKeys> items", ^{ + NSArray *expectedCustomKeys = [testCustomKeysLong subarrayWithRange:NSMakeRange(0, numConfigurableKeys)]; + testKeyboardProperties.customKeys = testCustomKeysLong; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).notTo(beNil()); + expect(resultProperties.customKeys.count).to(equal(numConfigurableKeys)); + expect(resultProperties.customKeys).to(equal(expectedCustomKeys)); + }); + + it(@"customKeys should not be trimmed and should be equal to the initial array", ^{ + NSArray *testCustomKeys = [testCustomKeysLong subarrayWithRange:NSMakeRange(0, numConfigurableKeys)]; + testKeyboardProperties.customKeys = testCustomKeys; + SDLKeyboardProperties *resultProperties = [testStruct createValidKeyboardConfigurationBasedOnKeyboardCapabilitiesFromConfiguration:testKeyboardProperties]; + expect(resultProperties).notTo(beNil()); + expect(resultProperties.customKeys.count).to(equal(numConfigurableKeys)); + expect(resultProperties.customKeys).to(equal(testCustomKeys)); + }); + }); }); }); diff --git a/generator/test/test_functions.py b/generator/test/test_functions.py index d2b885e21..ad4dcc6cb 100644 --- a/generator/test/test_functions.py +++ b/generator/test/test_functions.py @@ -68,7 +68,8 @@ class TestFunctionsProducer(TestCase): structs = { 'SoftButton': Struct(name='SoftButton', members={ 'image': Param(name='image', param_type=String(), since='1.0.0', description=['image description']), - 'ignore': Param(name='ignore', param_type=Struct(name='ignore'))}), + 'dayColorScheme': Param(name='dayColorScheme', param_type=Struct(name='TemplateColorScheme', description=[ + '\nA color scheme for all display layout templates.\n']))}), 'PresetBankCapabilities': Struct(name='PresetBankCapabilities', members={ 'availableHdChannelsAvailable': Param(name='availableHdChannelsAvailable', param_type=Boolean(), since='2.0.0', @@ -89,11 +90,8 @@ class TestFunctionsProducer(TestCase): self.producer.common_names(description=['availableHDChannelsAvailable description'], since='2.0.0', name='AvailableHdChannelsAvailable', origin='availableHdChannelsAvailable'), - self.producer.common_names(description=[], name='Ignore', origin='ignore', since=None), + self.producer.common_names(description=[], name='DayColorScheme', origin='dayColorScheme', since=None), self.producer.common_names(description=['image description'], name='Image', origin='image', since='1.0.0'), - self.producer.common_names(description=[], name='PresetBankCapabilities', origin='PresetBankCapabilities', - since=None), - self.producer.common_names(description=[], name='SoftButton', origin='SoftButton', since=None), self.producer.common_names(description=['syncMsgVersion description'], name='SdlMsgVersion', origin='syncMsgVersion', since='3.5.0')] actual = self.producer.get_simple_params(functions, structs) diff --git a/generator/transformers/functions_producer.py b/generator/transformers/functions_producer.py index 73091fe12..eaf84bf55 100644 --- a/generator/transformers/functions_producer.py +++ b/generator/transformers/functions_producer.py @@ -88,17 +88,15 @@ class FunctionsProducer(InterfaceProducerCommon): """ origin = element.name name = self._replace_sync(element.name) - # if isinstance(element.param_type, (Integer, Float, Boolean, String)): return {name: self.common_names(**{ 'name': self.title(name), 'origin': origin, 'description': self.extract_description(element.description), 'since': element.since})} - # return OrderedDict() def get_simple_params(self, functions: dict, structs: dict) -> dict: """ - Standalone method used for preparing SDLRPCParameterNames collection ready to be applied to Jinja2 template + Creates a list of all parameter names used in functions and structs. This list is used by a Jinja2 template to generate the SDLRPCParameterNames class. :param functions: collection with all functions from initial Model :param structs: collection with all structs from initial Model :return: collection with transformed element ready to be applied to Jinja2 template @@ -110,8 +108,8 @@ class FunctionsProducer(InterfaceProducerCommon): render.update(self.evaluate(param)) for struct in structs.values(): - render.update(self.evaluate(struct)) for param in struct.members.values(): render.update(self.evaluate(param)) + unique = dict(zip(list(map(lambda l: l.name, render.values())), render.values())) return {'params': sorted(unique.values(), key=lambda a: a.name)} |