summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rw-r--r--CHANGELOG.md25
-rw-r--r--VERSION2
-rwxr-xr-xandroid/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java31
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Alert.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CancelInteraction.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CreateWindow.json17
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteWindow.json13
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json23
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetVehicleData.json6
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformInteraction.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Show.json38
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json13
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Slider.json3
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json7
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java79
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java62
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java226
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java223
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java31
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java270
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java111
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java99
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java27
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java91
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java190
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java63
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java55
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java68
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java135
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java95
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java95
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java89
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java133
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java72
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java72
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java83
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java9
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java19
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java41
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java39
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java80
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java71
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java98
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java44
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java31
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java63
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java70
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java188
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java1
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java63
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java80
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java10
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java135
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java4
-rw-r--r--android/sdl_android/src/main/res/values/strings.xml1
-rw-r--r--android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java126
-rw-r--r--android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java116
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java125
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java21
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java102
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java94
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java196
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java29
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java161
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java43
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java44
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java88
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java47
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java133
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java96
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java81
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java132
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java70
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java62
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java44
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java62
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java99
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java57
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java97
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java110
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java186
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java78
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java52
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java53
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java8
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java1
-rw-r--r--hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java20
-rw-r--r--hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java20
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/BuildConfig.java2
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java61
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java25
200 files changed, 8799 insertions, 912 deletions
diff --git a/.travis.yml b/.travis.yml
index 96bbd4a27..625caaa52 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,6 @@
language: android
jdk: oraclejdk8
+dist: trusty
sudo: false
android:
components:
@@ -8,7 +9,7 @@ android:
- tools
- platform-tools
- ndk-bundle
-
+
# The BuildTools version used by your project
- build-tools-28.0.3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cabd706d..40d356106 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,24 +1,5 @@
-# 4.9.0 Release Notes
+# 4.9.1 Release Notes
-## Feature
+### Hotfix
-- [[SDL 0157] Mobile Choice Set Manager](https://github.com/smartdevicelink/sdl_java_suite/issues/764)
-- [[SDL 0155] Mobile Menu Manager](https://github.com/smartdevicelink/sdl_java_suite/issues/730)
-- [[SDL 0210]-Mobile Manager Dynamic Menu Cell Updating ](https://github.com/smartdevicelink/sdl_java_suite/issues/961)
-- [[SDL 0232] Added Pushing Buffer Support to AudioStreamManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1075)
-- [Library will dynamically check if head unit requires VR synonyms for Choice items](https://github.com/smartdevicelink/sdl_java_suite/issues/941)
-- [VideoStreamingManager now fully supports multi-touch events](https://github.com/smartdevicelink/sdl_java_suite/issues/972)
-
-
-
-## Bug Fixes
-
-- [Symlinks broken on Windows](https://github.com/smartdevicelink/sdl_java_suite/issues/1062) - Windows user must run a gradle task (`buildWindowSymLinks`) in order to create the Windows version of symlinks.
-- [Audio over AOA Issues](https://github.com/smartdevicelink/sdl_java_suite/issues/1056) - Media apps will now wait until an audio output device is ready before connecting over a transport. This can be overwritten by the developer.
-- [Fixed LeftRearInflatableBelted using the wrong key value in BeltStatus Class](https://github.com/smartdevicelink/sdl_java_suite/issues/1078)
-- [New Router Service and old USB Transport compatibility issues](https://github.com/smartdevicelink/sdl_java_suite/issues/1064) - Fixed an issue that caused apps not close when a legacy AOA app was chosen by the user.
-- [Fixed an issue with `sendSequentialRPCs` where it didn't call `onResponse` and stoped on first `onError`](https://github.com/smartdevicelink/sdl_java_suite/issues/1061)
-
-## Misc
-- [Updated library to use the newest BSON library](https://github.com/smartdevicelink/sdl_java_suite/pull/1072)
-- [Update gradle plugin](https://github.com/smartdevicelink/sdl_java_suite/pull/1077)
+- [Fix ChoiceSetManager issue with HUs that require VR for choices](https://github.com/smartdevicelink/sdl_java_suite/issues/1137) \ No newline at end of file
diff --git a/VERSION b/VERSION
index b617d997d..1f1ac7c2f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.9.0 \ No newline at end of file
+4.9.1 \ No newline at end of file
diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
index 9ad06490a..6b7e77c69 100755
--- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
+++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
@@ -15,6 +15,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -32,7 +33,9 @@ import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
+import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -51,6 +54,8 @@ public class SdlService extends Service {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -157,7 +162,7 @@ public class SdlService extends Service {
// The app type to be used
Vector<AppHMIType> appType = new Vector<>();
- appType.add(AppHMIType.MEDIA);
+ appType.add(AppHMIType.DEFAULT);
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
// Here we will listen for ON_HMI_STATUS and ON_COMMAND notifications
@@ -168,8 +173,11 @@ public class SdlService extends Service {
sdlManager.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus status = (OnHMIStatus) notification;
- if (status.getHmiLevel() == HMILevel.HMI_FULL && ((OnHMIStatus) notification).getFirstRun()) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ if (onHMIStatus.getHmiLevel() == HMILevel.HMI_FULL && onHMIStatus.getFirstRun()) {
setVoiceCommands();
sendMenus();
performWelcomeSpeak();
@@ -188,6 +196,23 @@ public class SdlService extends Service {
@Override
public void onError(String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
// Create App Icon, this is set in the SdlManager builder
diff --git a/android/sdl_android/src/androidTest/assets/json/Alert.json b/android/sdl_android/src/androidTest/assets/json/Alert.json
index 7e8397a62..75ff2ca50 100644
--- a/android/sdl_android/src/androidTest/assets/json/Alert.json
+++ b/android/sdl_android/src/androidTest/assets/json/Alert.json
@@ -9,6 +9,7 @@
"alertText2":"Line 2",
"alertText3":"Line 3",
"progressIndicator":true,
+ "cancelID":45,
"alertIcon":{
"value":"alertIconImage1.png",
"imageType":"DYNAMIC"
diff --git a/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
new file mode 100644
index 000000000..dc420ad8f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"CancelInteraction",
+ "correlationID":554,
+ "parameters":{
+ "cancelID":6052,
+ "functionID":12
+ }
+ },
+ "response":{
+ "name":"CancelInteractionResponse",
+ "correlationID":554
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CreateWindow.json b/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
new file mode 100644
index 000000000..6322b5250
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
@@ -0,0 +1,17 @@
+{
+ "request":{
+ "name":"CreateWindow",
+ "correlationID":107,
+ "parameters":{
+ "windowID":765,
+ "windowName":"Window Name",
+ "type": "MAIN",
+ "associatedServiceType":"Service Type",
+ "duplicateUpdatesFromWindowID":766
+ }
+ },
+ "response":{
+ "name":"CreateWindowResponse",
+ "correlationID":108
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json b/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
new file mode 100644
index 000000000..69b9013b1
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"DeleteWindow",
+ "correlationID":109,
+ "parameters":{
+ "windowID":765
+ }
+ },
+ "response":{
+ "name":"DeleteWindowResponse",
+ "correlationID":110
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
new file mode 100644
index 000000000..5ab1c6c41
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
@@ -0,0 +1,23 @@
+{
+ "request":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":168,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":[
+ "A0A",
+ "R0A"
+ ]
+ }
+ },
+ "response":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":169,
+ "parameters":{
+ "allowed":[
+ true,
+ true
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
index 81b25ef87..7cef581b7 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
@@ -31,7 +31,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -168,7 +169,8 @@
"type":"DIESEL",
"range":10.0
}
- ]
+ ],
+ "oemCustomVehicleDataName":"oemCustomVehicleDataState"
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
index b8965ee61..583a72b1c 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
@@ -43,6 +43,7 @@
}
],
"timeout":0,
+ "cancelID":45,
"vrHelp":[
{
"position":7,
diff --git a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
new file mode 100644
index 000000000..9f9f60096
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":172,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":"A0A"
+ }
+ },
+ "response":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":173
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
index f86dc188c..3b14d1a43 100644
--- a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
+++ b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
@@ -5,6 +5,7 @@
"parameters":{
"scrollableMessageBody":"Sample body text",
"timeout":1000,
+ "cancelID":45,
"softButtons":[
{
"isHighlighted":true,
diff --git a/android/sdl_android/src/androidTest/assets/json/Show.json b/android/sdl_android/src/androidTest/assets/json/Show.json
index db189b34a..6afe27d72 100644
--- a/android/sdl_android/src/androidTest/assets/json/Show.json
+++ b/android/sdl_android/src/androidTest/assets/json/Show.json
@@ -22,6 +22,44 @@
"mediaClock":"Media Clock",
"alignment":"LEFT_ALIGNED",
"mediaTrack":"Media Track",
+ "windowID":10,
+ "templateConfiguration": {
+ "template": "template",
+ "dayColorScheme": {
+ "backgroundColor": {
+ "blue": 9,
+ "green": 8,
+ "red": 7
+ },
+ "secondaryColor": {
+ "blue": 6,
+ "green": 5,
+ "red": 4
+ },
+ "primaryColor": {
+ "blue": 3,
+ "green": 2,
+ "red": 1
+ }
+ },
+ "nightColorScheme": {
+ "backgroundColor": {
+ "blue": 18,
+ "green": 17,
+ "red": 16
+ },
+ "secondaryColor": {
+ "blue": 15,
+ "green": 14,
+ "red": 13
+ },
+ "primaryColor": {
+ "blue": 12,
+ "green": 11,
+ "red": 10
+ }
+ }
+ },
"secondaryGraphic":{
"value":"image2.png",
"imageType":"STATIC"
diff --git a/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
new file mode 100644
index 000000000..8870423de
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"ShowAppMenu",
+ "correlationID":187,
+ "parameters":{
+ "menuID":100
+ }
+ },
+ "response":{
+ "name":"ShowAppMenuResponse",
+ "correlationID":188
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/Slider.json b/android/sdl_android/src/androidTest/assets/json/Slider.json
index 38f033df4..5b69f4728 100644
--- a/android/sdl_android/src/androidTest/assets/json/Slider.json
+++ b/android/sdl_android/src/androidTest/assets/json/Slider.json
@@ -12,7 +12,8 @@
"Header Line 4"
],
"position":11,
- "timeout":30000
+ "timeout":30000,
+ "cancelID":45
}
},
"response":{
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
index 92cf00a1b..4abab4cc0 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
@@ -30,7 +30,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -148,6 +149,10 @@
"electronicParkBrakeStatus":{
"dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
"resultCode":"SUCCESS"
+ },
+ "oemCustomVehicleDataName":{
+ "oemCustomDataType":"oemCustomVehicleDataName",
+ "resultCode":"SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
index d01b99aa8..f6f8860fb 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
@@ -30,7 +30,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -148,6 +149,10 @@
"electronicParkBrakeStatus":{
"dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
"resultCode":"SUCCESS"
+ },
+ "oemCustomVehicleDataName":{
+ "oemCustomDataType":"oemCustomVehicleDataName",
+ "resultCode":"SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index 1c465c382..5c6656bf9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -4,6 +4,7 @@ import android.content.Context;
import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
@@ -104,6 +105,11 @@ public class SdlManagerTests extends AndroidTestCase2 {
public void onError(String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ return null;
+ }
};
// build manager object - use all setters, will test using getters below
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
new file mode 100644
index 000000000..6ed606648
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 8/2/19 11:27 AM
+ *
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.test.Test;
+
+public class LifecycleConfigurationUpdateTest extends AndroidTestCase2 {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testIndividualSettersAndGetters(){
+
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate();
+
+ lifecycleConfigurationUpdate.setAppName(Test.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setShortAppName(Test.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setTtsName(Test.GENERAL_VECTOR_TTS_CHUNKS);
+ lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(Test.GENERAL_VECTOR_STRING);
+
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
+
+ public void testHelperConstructor(){
+
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VECTOR_TTS_CHUNKS, Test.GENERAL_VECTOR_STRING);
+
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
+
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
index c2d4066ce..0bf3dd5ae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
@@ -3,7 +3,6 @@ package com.smartdevicelink.managers.lockscreen;
import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.test.Test;
-
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenConfig}
@@ -25,6 +24,7 @@ public class LockScreenConfigTests extends AndroidTestCase2 {
lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
}
@Override
@@ -38,8 +38,9 @@ public class LockScreenConfigTests extends AndroidTestCase2 {
assertEquals(Test.GENERAL_INT, lockScreenConfig.getCustomView());
assertEquals(Test.GENERAL_INT, lockScreenConfig.getAppIcon());
assertEquals(Test.GENERAL_INT, lockScreenConfig.getBackgroundColor());
- assertEquals(true, lockScreenConfig.isEnabled());
- assertEquals(true, lockScreenConfig.isDeviceLogoEnabled());
+ assertTrue(lockScreenConfig.isEnabled());
+ assertTrue(lockScreenConfig.isDeviceLogoEnabled());
+ assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenConfig.getDisplayMode());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
index 69e0aa898..1d294e100 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
@@ -3,10 +3,21 @@ package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
+import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.test.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -16,6 +27,7 @@ import static org.mockito.Mockito.mock;
public class LockScreenManagerTests extends AndroidTestCase2 {
private LockScreenManager lockScreenManager;
+ private OnRPCNotificationListener onDDListener;
@Override
public void setUp() throws Exception{
@@ -23,6 +35,16 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
ISdl internalInterface = mock(ISdl.class);
+ Answer<Void> onDDStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ onDDListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onDDStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_DRIVER_DISTRACTION), any(OnRPCNotificationListener.class));
+
Context context = getContext();
// create config
LockScreenConfig lockScreenConfig = new LockScreenConfig();
@@ -31,6 +53,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
}
@@ -44,13 +67,92 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertEquals(Test.GENERAL_INT, lockScreenManager.customView);
assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenIcon);
assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenColor);
- assertEquals(true, lockScreenManager.deviceLogoEnabled);
- assertEquals(true, lockScreenManager.lockScreenEnabled);
+ assertTrue(lockScreenManager.deviceLogoEnabled);
+ assertTrue(lockScreenManager.lockScreenEnabled);
assertNull(lockScreenManager.deviceLogo);
+ assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
+ }
+
+ public void testGetLockScreenStatusHmiNoneDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
+ assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
- public void testGetLockScreenStatus(){
+ public void testGetLockScreenStatusHmiBackgroundDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
-}
+ public void testGetLockScreenStatusHmiNoneDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiFullDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiFullDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiLimitedDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiLimitedDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue(){
+ lockScreenManager.enableDismissGesture = true;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertTrue(lockScreenManager.enableDismissGesture);
+ assertTrue(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse(){
+ lockScreenManager.enableDismissGesture = false;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertFalse(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse(){
+ lockScreenManager.enableDismissGesture = true;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(false);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertTrue(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableFalseAndDismissibilityTrue(){
+ lockScreenManager.enableDismissGesture = false;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertFalse(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
index 1f0d57e0a..a72ee75e0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
@@ -61,7 +61,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertNull(screenManager.getSoftButtonObjectById(1));
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
assertEquals(screenManager.getState(), BaseSubManager.READY);
- assertNotNull(screenManager.getMenuConfiguration());
+ assertNull(screenManager.getMenuConfiguration());
}
public void testSetTextField() {
@@ -129,7 +129,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertEquals(screenManager.getMenu(), Test.GENERAL_MENUCELL_LIST);
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.FORCE_ON);
// Should not set because of improper RAI response and improper HMI states
- assertNotNull(screenManager.getMenuConfiguration());
+ assertNull(screenManager.getMenuConfiguration());
}
public void testSetVoiceCommands(){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
index e52f7b273..b8af1a68c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
@@ -52,8 +52,14 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class ChoiceSetManagerTests extends AndroidTestCase2 {
@@ -98,7 +104,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(csm.nextChoiceId, 1);
assertTrue(csm.executor.isShutdown());
- assertTrue(csm.isVROptional);
+ assertFalse(csm.isVROptional);
assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
@@ -232,7 +238,61 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
for (ChoiceCell cell : returnedChoices){
assertEquals(cell.getText(), "test2");
}
+ }
+
+ public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.READY);
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNotNull(cancelId);
}
+ public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.ERROR);
+
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNull(cancelId);
+ }
+
+ public void testDismissingExecutingKeyboard(){
+ Integer testCancelID = 42;
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(testCancelID).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(1)).dismissKeyboard();
+ }
+
+ public void testDismissingQueuedKeyboard(){
+ Integer testCancelID = 42;
+
+ // Currently executing operation
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp).isExecuting();
+ doReturn(96).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+
+ // Queued operations
+ PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp2).isExecuting();
+ doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
+ LinkedBlockingQueue<Runnable> testOperationQueue = new LinkedBlockingQueue<>();
+ testOperationQueue.add(testKeyboardOp2);
+ csm.operationQueue = testOperationQueue;
+
+ // Queued operation should be canceled
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(0)).dismissKeyboard();
+ verify(testKeyboardOp2, times(1)).dismissKeyboard();
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
index 3d7a30a79..900336594 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
@@ -46,6 +46,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
private ChoiceSetLayout layout;
private List<ChoiceCell> choices;
private Integer defaultTimeout;
+ private Boolean canceledHandlerCalled;
@Override
public void setUp() throws Exception{
@@ -55,6 +56,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
defaultTimeout = 10;
choices = Arrays.asList(new ChoiceCell(Test.GENERAL_STRING), new ChoiceCell(Test.GENERAL_STRING));
+ canceledHandlerCalled = false;
}
@Override
@@ -98,4 +100,18 @@ public class ChoiceSetTests extends AndroidTestCase2 {
assertEquals(choiceSet2.getChoices(), choices);
assertEquals(choiceSet2.getChoiceSetSelectionListener(), listener);
}
+
+ public void testCancelingChoiceSet() {
+ ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, choices, listener);
+
+ choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ canceledHandlerCalled = true;
+ }
+ };
+
+ choiceSet.cancel();
+ assertTrue(canceledHandlerCalled);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
index ea5204eae..d8cf5be9d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
@@ -36,34 +36,60 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
import java.util.Collections;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
private PresentChoiceSetOperation presentChoiceSetOperation;
+ private ChoiceSet choiceSet;
+ private ISdl internalInterface;
+ private KeyboardListener keyboardListener;
+ private ChoiceSetSelectionListener choiceSetSelectionListener;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- ChoiceSetSelectionListener choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+ internalInterface = mock(ISdl.class);
+
+ keyboardListener = mock(KeyboardListener.class);
+ choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+
ChoiceCell cell1 = new ChoiceCell("Cell1");
cell1.setChoiceId(0);
- ChoiceSet choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener);
+ choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -71,35 +97,209 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
super.tearDown();
}
- public void testGetLayoutMode(){
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
+ public void testGetLayoutMode(){
// First we will check knowing our keyboard listener is NOT NULL
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
presentChoiceSetOperation.keyboardListener = null;
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
}
public void testGetPerformInteraction(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentChoiceSetOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getTimeout(), Integer.valueOf(10000));
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
}
public void testSetSelectedCellWithId(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertNull(presentChoiceSetOperation.selectedCellRow);
presentChoiceSetOperation.setSelectedCellWithId(0);
assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
}
-}
+ public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation.finishOperation();
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
index ccf498293..486a1c361 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
@@ -36,27 +36,66 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentKeyboardOperationTests extends AndroidTestCase2 {
private PresentKeyboardOperation presentKeyboardOperation;
+ private KeyboardListener keyboardListener;
+ private ISdl internalInterface;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener);
+ internalInterface = mock(ISdl.class);
+ keyboardListener = mock(KeyboardListener.class);
+
+ Answer<Void> setGlobalPropertiesAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ SetGlobalProperties setGlobalProperties = (SetGlobalProperties) args[0];
+
+ RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
+ response.setSuccess(true);
+ setGlobalProperties.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(setGlobalPropertiesAnswer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -64,20 +103,186 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
super.tearDown();
}
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
public void testGetPerformInteraction(){
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentKeyboardOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getInteractionLayout(), LayoutMode.KEYBOARD);
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation.finishOperation();
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index d06d96bdc..fe20383a0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -53,6 +53,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -138,7 +139,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertNull(menuManager.inProgressUpdate);
assertNull(menuManager.keepsNew);
assertNull(menuManager.keepsOld);
- assertNotNull(menuManager.menuConfiguration);
+ assertNull(menuManager.menuConfiguration);
assertNotNull(menuManager.hmiListener);
assertNotNull(menuManager.commandListener);
assertNotNull(menuManager.displayListener);
@@ -445,6 +446,30 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ public void testOpeningMainMenu(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ mockMenuManager.openMenu();
+ verify(mockMenuManager, Mockito.times(1)).openMenu();
+ }
+
+ public void testOpeningSubMenuNullCells(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ MenuCell cell = mock(MenuCell.class);
+ mockMenuManager.oldMenuCells = null;
+ assertFalse(mockMenuManager.openSubMenu(cell));
+ }
+
+ public void testOpeningSubMenu(){
+ // call open Menu
+ List<MenuCell> testCells = createTestCells();
+ menuManager.oldMenuCells = testCells;
+ menuManager.sdlMsgVersion = new SdlMsgVersion(6,0);
+ // has to get success response to be true
+ assertTrue(menuManager.openSubMenu(testCells.get(3)));
+ }
+
public void testSetMenuConfiguration(){
menuManager.currentHMILevel = HMILevel.HMI_FULL;
menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
@@ -453,6 +478,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
MenuConfiguration menuConfigurationTest = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
menuManager.setMenuConfiguration(menuConfigurationTest);
assertEquals(menuManager.menuConfiguration, menuConfigurationTest);
+
}
// HELPERS
@@ -489,7 +515,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
MenuCell subCell1 = new MenuCell("SubCell 1",null, null, menuSelectionListenerSub1);
MenuCell subCell2 = new MenuCell("SubCell 2",null, null, menuSelectionListenerSub2);
- mainCell4 = new MenuCell("Test Cell 4", MenuLayout.LIST, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4 = new MenuCell("Test Cell 4", null, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4.setCellId(4);
return Arrays.asList(mainCell1, mainCell2, mainCell3, mainCell4);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
index 76bce2e7a..f456b33b3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.managers.video;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
@@ -15,6 +16,7 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.TouchCoord;
@@ -450,4 +452,49 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
+
+ public void testConvertTouchEvent_Scale_1() {
+ assertMotionEventWithScale(800, 480, 1.0f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_25() {
+ assertMotionEventWithScale(1280, 768, 1.25f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_5() {
+ assertMotionEventWithScale(1280, 768, 1.5f);
+ }
+
+ private void assertMotionEventWithScale(int width, int height, float scale) {
+ ISdl internalInterface = mock(ISdl.class);
+
+ // Preferred Resolution capability
+ ImageResolution resolution = new ImageResolution(width, height);
+
+ // Remote display
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ displayMetrics.widthPixels = (int) (resolution.getResolutionWidth() / scale);
+ displayMetrics.heightPixels = (int) (resolution.getResolutionHeight() / scale);
+
+
+ VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.createTouchScalar(resolution, displayMetrics);
+
+ List<MotionEvent> motionEventList;
+ long e1TS = 1558124390L;
+ int e1x = 50, e1y = 100;
+ int e1Id = 100;
+ OnTouchEvent testOnTouchEvent;
+ MotionEvent motionEvent;
+ TouchEvent touchEvent1 = new TouchEvent(e1Id, Collections.singletonList(e1TS), Collections.singletonList(new TouchCoord(e1x, e1y)));
+
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+
+
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(Math.round(e1x / scale), Math.round(motionEvent.getX(0)));
+ assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
index 375de9362..5cb0cf719 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
@@ -170,6 +170,24 @@ public final class JsonUtils {
return null;
}
+
+ public static List<Boolean> readBooleanListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<Boolean> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ Boolean bool = jsonArray.getBoolean(i);
+ result.add(bool);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
public static List<Double> readDoubleListFromJsonObject(JSONObject json, String key){
JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 9669daf83..793b2b035 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -34,7 +34,9 @@ import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
+import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
@@ -56,6 +58,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
import com.smartdevicelink.proxy.rpc.NavigationServiceData;
@@ -75,6 +78,7 @@ import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlData;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
@@ -86,6 +90,7 @@ import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
@@ -100,6 +105,8 @@ import com.smartdevicelink.proxy.rpc.WeatherAlert;
import com.smartdevicelink.proxy.rpc.WeatherData;
import com.smartdevicelink.proxy.rpc.WeatherServiceData;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
@@ -192,6 +199,7 @@ import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
import com.smartdevicelink.proxy.rpc.enums.WayPointType;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.util.Version;
import org.json.JSONArray;
@@ -345,6 +353,7 @@ public class Test {
public static final AudioStreamingIndicator GENERAL_AUDIO_STREAMING_INDICATOR = AudioStreamingIndicator.PLAY;
public static final String GENERAL_APP_ID = "123e4567e8";
public static final String GENERAL_FULL_APP_ID = "123e4567-e89b-12d3-a456-426655440000";
+ public static final String GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME = "oemCustomVehicleDataName";
public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
public static final CloudAppProperties GENERAL_CLOUDAPPPROPERTIES = new CloudAppProperties();
public static final AppServiceType GENERAL_APP_SERVICE_TYPE = AppServiceType.MEDIA;
@@ -400,6 +409,13 @@ public class Test {
public static final AudioControlData GENERAL_AUDIOCONTROLDATA = new AudioControlData();
public static final LightControlData GENERAL_LIGHTCONTROLDATA = new LightControlData();
public static final HMISettingsControlData GENERAL_HMISETTINGSCONTROLDATA = new HMISettingsControlData();
+
+ public static final VehicleDataResult GENERAL_OEM_CUSTOM_VEHICLE_DATA = new VehicleDataResult();
+ public static final TemplateConfiguration GENERAL_TEMPLATE_CONFIGURATION = new TemplateConfiguration();
+ public static final WindowTypeCapabilities GENERAL_WINDOW_TYPE_CAPABILITIES = new WindowTypeCapabilities();
+ public static final WindowCapability GENERAL_WINDOW_CAPABILITY = new WindowCapability();
+ public static final DisplayCapability GENERAL_DISPLAY_CAPABILITY = new DisplayCapability();
+
public static final SdlArtwork GENERAL_ARTWORK = new SdlArtwork("sdl", FileType.GRAPHIC_PNG, R.drawable.ic_sdl, false);
public static final MenuLayout GENERAL_MENU_LAYOUT = MenuLayout.LIST;
public static final MenuConfiguration GENERAL_MENU_CONFIGURATION = new MenuConfiguration(GENERAL_MENU_LAYOUT, GENERAL_MENU_LAYOUT);
@@ -411,7 +427,10 @@ public class Test {
public static final HapticRect GENERAL_HAPTIC_RECT = new HapticRect();
public static final FuelType GENERAL_FUELTYPE = FuelType.GASOLINE;
public static final LockScreenConfig GENERAL_LOCKSCREENCONFIG = new LockScreenConfig();
-
+ public static final Grid GENERAL_GRID = new Grid();
+ public static final SeatLocation GENERAL_SEAT_LOCATION = new SeatLocation();
+ public static final ModuleInfo GENERAL_MODULE_INFO = new ModuleInfo();
+ public static final WindowType GENERAL_WINDOW_TYPE = WindowType.MAIN;
public static final List<Long> GENERAL_LONG_LIST = Arrays.asList(new Long[]{ 1L, 2L });
public static final List<Turn> GENERAL_TURN_LIST = new ArrayList<Turn>();
public static final List<Choice> GENERAL_CHOICE_LIST = new ArrayList<Choice>();
@@ -459,7 +478,13 @@ public class Test {
public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA);
public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
+ public static final List<SeatLocation> GENERAL_SEAT_LIST = new ArrayList<>(1);
+ public static final List<Boolean> GENERAL_BOOLEAN_LIST = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.TRUE});
public static final List<Integer> GENERAL_AVAILABLE_HD_CHANNELS_LIST = Arrays.asList(new Integer[]{ 1, 2});
+ public static final List<ImageType> GENERAL_IMAGE_TYPE_LIST = Arrays.asList(new ImageType[]{ImageType.DYNAMIC, ImageType.STATIC});
+ public static final List<WindowTypeCapabilities> GENERAL_WINDOW_TYPE_CAPABILITIES_LIST = new ArrayList<WindowTypeCapabilities>(1);
+ public static final List<WindowCapability> GENERAL_WINDOW_CAPABILITY_LIST = new ArrayList<WindowCapability>(1);
+ public static final List<DisplayCapability> GENERAL_DISPLAYCAPABILITY_LIST = new ArrayList<DisplayCapability>(1);
public static final List<MenuLayout> GENERAL_MENU_LAYOUT_LIST = Arrays.asList(MenuLayout.LIST, MenuLayout.TILES);
public static final int GENERAL_MENU_MAX_ID = 2000000000;
public static final MenuCell GENERAL_MENUCELL = new MenuCell(GENERAL_STRING,null, null, new MenuSelectionListener() {
@@ -497,6 +522,7 @@ public class Test {
public static final JSONArray JSON_RADIOCONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_CLIMATECONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray();
+ public static final JSONArray JSON_SEAT_LOCATIONS = new JSONArray();
public static final JSONObject JSON_TURN = new JSONObject();
public static final JSONObject JSON_IMAGE = new JSONObject();
public static final JSONObject JSON_CHOICE = new JSONObject();
@@ -524,7 +550,16 @@ public class Test {
public static final JSONObject JSON_RGBCOLOR = new JSONObject();
public static final JSONObject JSON_DAYCOLORSCHEME = new JSONObject();
public static final JSONObject JSON_NIGHTCOLORSCHEME = new JSONObject();
-
+ public static final JSONObject JSON_GRID = new JSONObject();
+ public static final JSONObject JSON_MODULE_INFO = new JSONObject();
+ public static final JSONArray JSON_IMAGE_TYPE_SUPPORTED = new JSONArray();
+ public static final JSONObject JSON_WINDOW_TYPE_CAPABILITIES = new JSONObject();
+ public static final JSONArray JSON_WINDOW_TYPE_CAPABILITIES_LIST = new JSONArray();
+ public static final JSONObject JSON_WINDOW_CAPABILITY = new JSONObject();
+ public static final JSONArray JSON_WINDOW_CAPABILITIES = new JSONArray();
+ public static final JSONArray JSON_IMAGE_TYPES = new JSONArray();
+ public static final JSONObject JSON_DISPLAYCAPABILITY = new JSONObject();
+ public static final JSONArray JSON_DISPLAYCAPABILITY_LIST = new JSONArray();
static {
GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
@@ -671,16 +706,40 @@ public class Test {
GENERAL_IMAGEFIELD.setImageTypeSupported(GENERAL_FILETYPE_LIST);
GENERAL_IMAGEFIELD_LIST.add(GENERAL_IMAGEFIELD);
+ GENERAL_WINDOW_TYPE_CAPABILITIES.setType(GENERAL_WINDOW_TYPE);
+ GENERAL_WINDOW_TYPE_CAPABILITIES.setMaximumNumberOfWindows(GENERAL_INT);
+ GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.add(GENERAL_WINDOW_TYPE_CAPABILITIES);
+
+ GENERAL_WINDOW_CAPABILITY.setWindowID(GENERAL_INT);
+ GENERAL_WINDOW_CAPABILITY.setTextFields(GENERAL_TEXTFIELD_LIST);
+ GENERAL_WINDOW_CAPABILITY.setImageFields(GENERAL_IMAGEFIELD_LIST);
+ GENERAL_WINDOW_CAPABILITY.setImageTypeSupported(GENERAL_IMAGE_TYPE_LIST);
+ GENERAL_WINDOW_CAPABILITY.setTemplatesAvailable(GENERAL_STRING_LIST);
+ GENERAL_WINDOW_CAPABILITY.setNumCustomPresetsAvailable(GENERAL_INT);
+ GENERAL_WINDOW_CAPABILITY.setButtonCapabilities(GENERAL_BUTTONCAPABILITIES_LIST);
+ GENERAL_WINDOW_CAPABILITY.setSoftButtonCapabilities(GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ GENERAL_WINDOW_CAPABILITY_LIST.add(GENERAL_WINDOW_CAPABILITY);
+
+ GENERAL_DISPLAY_CAPABILITY.setDisplayName(GENERAL_STRING);
+ GENERAL_DISPLAY_CAPABILITY.setWindowTypeSupported(GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
+ GENERAL_DISPLAY_CAPABILITY.setWindowCapabilities(GENERAL_WINDOW_CAPABILITY_LIST);
+ GENERAL_DISPLAYCAPABILITY_LIST.add(GENERAL_DISPLAY_CAPABILITY);
+
GENERAL_SCREENPARAMS.setImageResolution(GENERAL_IMAGERESOLUTION);
GENERAL_SCREENPARAMS.setTouchEventAvailable(GENERAL_TOUCHEVENTCAPABILITIES);
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK1);
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK2);
+ GENERAL_SEAT_LIST.add(GENERAL_SEAT_LOCATION);
GENERAL_IMAGE.setValue(GENERAL_STRING);
GENERAL_IMAGE.setImageType(GENERAL_IMAGETYPE);
GENERAL_IMAGE.setIsTemplate(GENERAL_BOOLEAN);
+ GENERAL_TEMPLATE_CONFIGURATION.setTemplate(GENERAL_STRING);
+ GENERAL_TEMPLATE_CONFIGURATION.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
+ GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+
GENERAL_SOFTBUTTON.setIsHighlighted(GENERAL_BOOLEAN);
GENERAL_SOFTBUTTON.setSoftButtonID(GENERAL_INT);
GENERAL_SOFTBUTTON.setSystemAction(SystemAction.STEAL_FOCUS);
@@ -740,6 +799,9 @@ public class Test {
GENERAL_VEHICLEDATARESULT_LIST.add(result);
}
+ GENERAL_OEM_CUSTOM_VEHICLE_DATA.setResultCode(VehicleDataResultCode.SUCCESS);
+ GENERAL_OEM_CUSTOM_VEHICLE_DATA.setOEMCustomVehicleDataType(GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+
GENERAL_DIDRESULT.setData(GENERAL_STRING);
GENERAL_DIDRESULT.setDidLocation(GENERAL_INT);
GENERAL_DIDRESULT.setResultCode(VehicleDataResultCode.SUCCESS);
@@ -1042,6 +1104,10 @@ public class Test {
GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
+ GENERAL_MODULE_INFO.setModuleId(Test.GENERAL_STRING);
+ GENERAL_MODULE_INFO.setModuleLocation(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setModuleServiceArea(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
try {
@@ -1067,6 +1133,9 @@ public class Test {
JSON_CHOICE.put(Choice.KEY_SECONDARY_IMAGE, JSON_IMAGE);
JSON_CHOICE.put(Choice.KEY_VR_COMMANDS, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+ JSON_IMAGE_TYPE_SUPPORTED.put(ImageType.DYNAMIC);
+ JSON_IMAGE_TYPE_SUPPORTED.put(ImageType.STATIC);
+
JSON_HMILEVELS.put(HMILevel.HMI_FULL);
JSON_HMILEVELS.put(HMILevel.HMI_BACKGROUND);
@@ -1215,6 +1284,23 @@ public class Test {
JSON_IMAGEFIELD.put(ImageField.KEY_NAME, ImageFieldName.graphic);
JSON_IMAGEFIELDS.put(JSON_IMAGEFIELD);
+ JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_TYPE, GENERAL_WINDOW_TYPE);
+ JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, GENERAL_INT);
+ JSON_WINDOW_TYPE_CAPABILITIES_LIST.put(JSON_WINDOW_TYPE_CAPABILITIES);
+
+ JSON_IMAGE_TYPES.put(ImageType.DYNAMIC);
+ JSON_IMAGE_TYPES.put(ImageType.STATIC);
+
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_WINDOW_ID, GENERAL_INT);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_TEXT_FIELDS, JSON_TEXTFIELDS);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_IMAGE_FIELDS, JSON_IMAGEFIELDS);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, JSON_IMAGE_TYPES);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, GENERAL_INT);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_BUTTON_CAPABILITIES, JSON_BUTTONCAPABILITIES);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, JSON_SOFTBUTTONCAPABILITIES);
+ JSON_WINDOW_CAPABILITIES.put(JSON_WINDOW_CAPABILITY);
+
JSONObject jsonTEC = new JSONObject();
jsonTEC.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, GENERAL_BOOLEAN);
jsonTEC.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, GENERAL_BOOLEAN);
@@ -1233,6 +1319,11 @@ public class Test {
JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_TEXT_FIELDS, JSON_TEXTFIELDS);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_DISPLAY_NAME, GENERAL_STRING);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, JSON_WINDOW_TYPE_CAPABILITIES_LIST);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, JSON_WINDOW_CAPABILITIES);
+ JSON_DISPLAYCAPABILITY_LIST.put(JSON_DISPLAYCAPABILITY);
+
JSON_TOUCHCOORD.put(TouchCoord.KEY_X, GENERAL_INT);
JSON_TOUCHCOORD.put(TouchCoord.KEY_Y, GENERAL_INT);
JSON_TOUCHCOORDS.put(JSON_TOUCHCOORD);
@@ -1246,6 +1337,13 @@ public class Test {
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ALBUM);
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST);
+ JSON_SEAT_LOCATIONS.put(JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index 4e03ac1aa..965098c3f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -26,11 +26,13 @@ import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DeviceStatus;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.ECallInfo;
import com.smartdevicelink.proxy.rpc.EmergencyEvent;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
import com.smartdevicelink.proxy.rpc.FuelRange;
import com.smartdevicelink.proxy.rpc.GPSData;
+import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
@@ -52,6 +54,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceData;
import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
@@ -72,6 +75,7 @@ import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlData;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
@@ -82,6 +86,7 @@ import com.smartdevicelink.proxy.rpc.StationIDNumber;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.TouchCoord;
@@ -97,6 +102,8 @@ import com.smartdevicelink.proxy.rpc.WeatherAlert;
import com.smartdevicelink.proxy.rpc.WeatherData;
import com.smartdevicelink.proxy.rpc.WeatherServiceData;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.FileType;
@@ -137,8 +144,13 @@ public class Validator{
return ( result1 == null );
}
- return ( result1.getDataType().equals(result2.getDataType())
- && result1.getResultCode().equals(result2.getResultCode()) );
+ if(result1.getDataType() != null && result2.getDataType() != null){
+ return ( result1.getDataType().equals(result2.getDataType())
+ && result1.getResultCode().equals(result2.getResultCode()) );
+ } else {
+ return ( result1.getOEMCustomVehicleDataType().equals(result2.getOEMCustomVehicleDataType())
+ && result1.getResultCode().equals(result2.getResultCode()) );
+ }
}
public static boolean validateBulkData(byte[] array1, byte[] array2){
@@ -550,6 +562,29 @@ public class Validator{
return true;
}
+ public static boolean validateTemplateConfiguration(TemplateConfiguration params1, TemplateConfiguration params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getTemplate().equals(params2.getTemplate())) {
+ return false;
+ }
+
+ if (!validateTemplateColorScheme(params1.getDayColorScheme(), params2.getDayColorScheme())) {
+ return false;
+ }
+
+ if (!validateTemplateColorScheme(params1.getNightColorScheme(), params2.getNightColorScheme())) {
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2){
if(list1 == null){
return ( list2 == null );
@@ -1500,6 +1535,29 @@ public class Validator{
return true;
}
+
+ public static boolean validateWindowTypeCapabilities(WindowTypeCapabilities item1, WindowTypeCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getType() == null) {
+ return (item2.getType() == null);
+ }
+
+ if (item1.getType() != item2.getType()) {
+ return false;
+ }
+
+ if (item1.getMaximumNumberOfWindows() != item2.getMaximumNumberOfWindows()) {
+ return false;
+ }
+
+ return true;
+ }
public static boolean validateFileTypes (List<FileType> item1, List<FileType> item2) {
if (item1 == null) {
@@ -2783,7 +2841,144 @@ public class Validator{
return true;
}
-
+
+ public static boolean validateDisplayCapability(DisplayCapability item1, DisplayCapability item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!item1.getDisplayName().equals(item2.getDisplayName())) {
+ return false;
+ }
+
+ if (item1.getWindowTypeSupported() == null) {
+ return (item2.getWindowTypeSupported() == null);
+ }
+
+ if (item1.getWindowTypeSupported().size() != item2.getWindowTypeSupported().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getWindowTypeSupported().size(); i++) {
+ if (item1.getWindowTypeSupported().get(i) == null && item2.getWindowTypeSupported().get(i) != null) {
+ return false;
+ }
+
+ if (!validateWindowTypeCapabilities(item1.getWindowTypeSupported().get(i), item2.getWindowTypeSupported().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getWindowCapabilities() == null) {
+ return (item2.getWindowCapabilities() == null);
+ }
+
+ if (item1.getWindowCapabilities().size() != item2.getWindowCapabilities().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getWindowCapabilities().size(); i++) {
+ if (item1.getWindowCapabilities().get(i) == null && item2.getWindowCapabilities().get(i) != null) {
+ return false;
+ }
+
+ if (!validateWindowCapability(item1.getWindowCapabilities().get(i), item2.getWindowCapabilities().get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateWindowCapability(WindowCapability item1, WindowCapability item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getWindowID() != item2.getWindowID()) {
+ return false;
+ }
+
+ if (!validateStringList(item1.getTemplatesAvailable(), item2.getTemplatesAvailable())) {
+ log("TA", item1.getTemplatesAvailable() + " | " + item2.getTemplatesAvailable());
+ return false;
+ }
+
+ if (item1.getNumCustomPresetsAvailable() != item2.getNumCustomPresetsAvailable()) {
+ return false;
+ }
+
+ if (item1.getTextFields() == null) {
+ return (item2.getTextFields() == null);
+ }
+
+ if (item1.getTextFields().size() != item2.getTextFields().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getTextFields().size(); i++) {
+ if (item1.getTextFields().get(i) == null && item2.getTextFields().get(i) != null) {
+ return false;
+ }
+
+ if (!validateTextFields(item1.getTextFields().get(i), item2.getTextFields().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getImageFields() == null) {
+ return (item2.getImageFields() == null);
+ }
+
+ if (item1.getImageFields().size() != item2.getImageFields().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getImageFields().size(); i++) {
+ if (item1.getImageFields().get(i) == null && item2.getImageFields().get(i) != null) {
+ return false;
+ }
+
+ if (!validateImageFields(item1.getImageFields().get(i), item2.getImageFields().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getImageTypeSupported() == null) {
+ return (item2.getImageTypeSupported() == null);
+ }
+
+ if (item1.getImageTypeSupported().size() != item2.getImageTypeSupported().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getImageTypeSupported().size(); i++) {
+ if (item1.getImageTypeSupported().get(i) == null) {
+ return (item2.getImageTypeSupported().get(i) == null);
+ }
+
+ if (item1.getImageTypeSupported().get(i) != item2.getImageTypeSupported().get(i)) {
+ return false;
+ }
+ }
+
+ if (!validateButtonCapabilities(item1.getButtonCapabilities(), item2.getButtonCapabilities())) {
+ return false;
+ }
+
+ if (!validateSoftButtonCapabilities(item1.getSoftButtonCapabilities(), item2.getSoftButtonCapabilities())) {
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateButtonCapabilities (List<ButtonCapabilities> item1, List<ButtonCapabilities> item2) {
if (item1 == null) {
return ( item2 == null );
@@ -3595,4 +3790,73 @@ public class Validator{
return true;
}
+
+ public static boolean validateGrid(Grid g1, Grid g2) {
+ String tag = "validateGrid";
+ if (g1 == null) {
+ return (g2 == null);
+ }
+ if (g2 == null) {
+ return (g1 == null);
+ }
+ if (g1.getColumn() != g2.getColumn()) {
+ log(tag, "Columns do not match");
+ return false;
+ }
+ if (g1.getRow() != g2.getRow()) {
+ log(tag, "Rows do not match");
+ return false;
+ }
+ if (g1.getLevel() != g2.getLevel()) {
+ log(tag, "Levels do not match");
+ return false;
+ }
+ if (g1.getColumnSpan() != g2.getColumnSpan()) {
+ log(tag, "Column spans do not match");
+ return false;
+ }
+ if (g1.getRowSpan() != g2.getRowSpan()) {
+ log(tag, "Row spans do not match");
+ return false;
+ }
+ if (g1.getLevelSpan() != g2.getLevelSpan()) {
+ log(tag, "Level spans do not match");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateModuleInfo(ModuleInfo m1, ModuleInfo m2) {
+ if (m1 == null) {
+ return (m2 == null);
+ }
+ if (m2 == null) {
+ return (m1 == null);
+ }
+ if (!m1.getModuleId().equals(m2.getModuleId())) {
+ return false;
+ }
+ if (!m1.getMultipleAccessAllowance().equals(m2.getMultipleAccessAllowance())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleLocation(), m2.getModuleLocation())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleServiceArea(), m2.getModuleServiceArea())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateSeatLocation(SeatLocation cap1, SeatLocation cap2) {
+ if (cap1 == null) {
+ return (cap2 == null);
+ }
+ if (cap2 == null) {
+ return (cap1 == null);
+ }
+ return validateGrid(cap1.getGrid(), cap2.getGrid());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
index 01f37774f..b0f753e13 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
@@ -77,6 +77,7 @@ public class VehicleDataHelper{
public static final List<FuelRange> FUEL_RANGE_LIST = new ArrayList<FuelRange>(1);
public static final TurnSignal TURN_SIGNAL = TurnSignal.OFF;
public static final ElectronicParkBrakeStatus ELECTRONIC_PARK_BRAKE_STATUS = ElectronicParkBrakeStatus.CLOSED;
+ public static final String OEM_CUSTOM_VEHICLE_DATA_STATE = "oemCustomVehicleDataState";
//other variables inside some of the above objects
// tire status
@@ -356,6 +357,7 @@ public class VehicleDataHelper{
VEHICLE_DATA.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
//set up the GetVehicleDataResponse object
VEHICLE_DATA_RESPONSE.setSpeed(SPEED);
@@ -387,6 +389,7 @@ public class VehicleDataHelper{
VEHICLE_DATA_RESPONSE.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA_RESPONSE.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
}
private VehicleDataHelper(){}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
index 524a6bde2..5351bf7a1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -30,6 +34,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
msg.setEqualizerAvailable(Test.GENERAL_BOOLEAN);
msg.setVolumeAvailable(Test.GENERAL_BOOLEAN);
msg.setEqualizerMaxChannelId(Test.GENERAL_INT);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -44,6 +49,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
Boolean volumeAvailable = msg.getVolumeAvailable();
Boolean equalizerAvailable = msg.getEqualizerAvailable();
int equalizerMaxChannelId = msg.getEqualizerMaxChannelId();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
@@ -52,6 +58,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) volumeAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
assertEquals(Test.MATCH, Test.GENERAL_INT, equalizerMaxChannelId);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
AudioControlCapabilities msg = new AudioControlCapabilities();
@@ -63,6 +70,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getVolumeAvailable());
assertNull(Test.NULL, msg.getEqualizerAvailable());
assertNull(Test.NULL, msg.getEqualizerMaxChannelId());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -76,6 +84,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, Test.GENERAL_INT);
+ reference.put(AudioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -83,9 +92,15 @@ public class AudioControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
-
+ if (key.equals(AudioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
index 4365ceafa..71f7d3ecf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
@@ -1,15 +1,19 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -28,6 +32,7 @@ public class ButtonCapabilitiesTests extends TestCase{
msg.setName(Test.GENERAL_BUTTONNAME);
msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
@@ -40,12 +45,14 @@ public class ButtonCapabilitiesTests extends TestCase{
boolean longPress = msg.getLongPressAvailable();
boolean upDown = msg.getUpDownAvailable();
ButtonName buttonName = msg.getName();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shortPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, longPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, upDown);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
ButtonCapabilities msg = new ButtonCapabilities();
@@ -65,15 +72,24 @@ public class ButtonCapabilitiesTests extends TestCase{
reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_NAME, Test.GENERAL_BUTTONNAME);
+ reference.put(ButtonCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(ButtonCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
index eb182f31c..a33f35b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
@@ -1,10 +1,13 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -13,6 +16,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -44,6 +48,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
msg.setHeatedWindshieldAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedRearWindowAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedMirrorsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
msg.setClimateEnableAvailable(Test.GENERAL_BOOLEAN);
}
@@ -68,6 +73,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
boolean heatedWindshieldAvailable = msg.getHeatedWindshieldAvailable();
boolean heatedRearWindowAvailable = msg.getHeatedRearWindowAvailable();
boolean heatedMirrorsAvailable = msg.getHeatedMirrorsAvailable();
+ ModuleInfo info = msg.getModuleInfo();
boolean climateEnableAvailable = msg.getClimateEnableAvailable();
// Valid Tests
@@ -81,6 +87,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
@@ -117,6 +124,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHeatedWindshieldAvailable());
assertNull(Test.NULL, msg.getHeatedRearWindowAvailable());
assertNull(Test.NULL, msg.getHeatedMirrorsAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
assertNull(Test.NULL, msg.getClimateEnableAvailable());
}
@@ -140,6 +148,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
@@ -175,6 +184,12 @@ public class ClimateControlCapabilitiesTests extends TestCase{
ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) );
}
assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
+ } else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
new file mode 100644
index 000000000..6bb57761f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
@@ -0,0 +1,111 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DisplayCapability}
+ */
+public class DisplayCapabilityTests extends TestCase {
+
+ private DisplayCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new DisplayCapability();
+
+ msg.setDisplayName(Test.GENERAL_STRING);
+ msg.setWindowTypeSupported(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
+ msg.setWindowCapabilities(Test.GENERAL_WINDOW_CAPABILITY_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String displayName = msg.getDisplayName();
+ List<WindowTypeCapabilities> windowTypeSupported = msg.getWindowTypeSupported();
+ List<WindowCapability> windowCapabilities = msg.getWindowCapabilities();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, displayName);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(), windowTypeSupported.size());
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_CAPABILITY_LIST.size(), windowCapabilities.size());
+
+ for (int i = 0; i < Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.get(i), windowTypeSupported.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_WINDOW_CAPABILITY_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateWindowCapability(Test.GENERAL_WINDOW_CAPABILITY_LIST.get(i), windowCapabilities.get(i)));
+ }
+
+ // Invalid/Null Tests
+ DisplayCapability msg = new DisplayCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getDisplayName());
+ assertNull(Test.NULL, msg.getWindowTypeSupported());
+ assertNull(Test.NULL, msg.getWindowCapabilities());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(DisplayCapability.KEY_DISPLAY_NAME, Test.GENERAL_STRING);
+ reference.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, Test.JSON_WINDOW_TYPE_CAPABILITIES_LIST);
+ reference.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, Test.JSON_WINDOW_CAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(new WindowTypeCapabilities(hashReference), new WindowTypeCapabilities(hashTest)));
+ }
+ } else if (key.equals(DisplayCapability.KEY_WINDOW_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateWindowCapability(new WindowCapability(hashReference), new WindowCapability(hashTest)));
+ }
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
new file mode 100644
index 000000000..95f94c3a7
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
@@ -0,0 +1,100 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class GridTests extends TestCase {
+
+ private Grid msg;
+
+ @Override
+ public void setUp() {
+ msg = new Grid();
+ msg.setColumn(Test.GENERAL_INT);
+ msg.setRow(Test.GENERAL_INT);
+ msg.setLevel(Test.GENERAL_INT);
+ msg.setColumnSpan(Test.GENERAL_INT);
+ msg.setRowSpan(Test.GENERAL_INT);
+ msg.setLevelSpan(Test.GENERAL_INT);
+ }
+
+ public void testRpcValues() {
+ int col = msg.getColumn();
+ int row = msg.getRow();
+ int level = msg.getLevel();
+ int colSpan = msg.getColumnSpan();
+ int rowSpan = msg.getRowSpan();
+ int levelSpan = msg.getLevelSpan();
+
+ //valid tests
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, colSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, rowSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, levelSpan, Test.GENERAL_INT);
+
+ //null tests
+ Grid msg = new Grid();
+ assertNull(Test.NULL, msg.getColumn());
+ assertNull(Test.NULL, msg.getRow());
+ assertNull(Test.NULL, msg.getLevel());
+ assertNull(Test.NULL, msg.getColumnSpan());
+ assertNull(Test.NULL, msg.getRowSpan());
+ assertNull(Test.NULL, msg.getLevelSpan());
+
+ //test required constructor
+ Grid msg2 = new Grid(Test.GENERAL_INT, Test.GENERAL_INT);
+ int row2 = msg2.getRow();
+ int col2 = msg2.getColumn();
+ assertEquals(Test.MATCH, col2, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, row2, Test.GENERAL_INT);
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(Grid.KEY_COLUMN, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL, Test.GENERAL_INT);
+ original.put(Grid.KEY_COL_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL_SPAN, Test.GENERAL_INT);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ Grid grid1, grid2;
+ while (iter.hasNext()) {
+ key = iter.next();
+ grid1 = new Grid(JsonRPCMarshaller.deserializeJSONObject(original));
+ grid2 = new Grid(JsonRPCMarshaller.deserializeJSONObject(serialized));
+ if (key.equals(Grid.KEY_COLUMN)) {
+ assertEquals(Test.MATCH, grid1.getColumn(), grid2.getColumn());
+ } else if (key.equals(Grid.KEY_ROW)) {
+ assertEquals(Test.MATCH, grid1.getRow(), grid2.getRow());
+ } else if (key.equals(Grid.KEY_LEVEL)) {
+ assertEquals(Test.MATCH, grid1.getLevel(), grid2.getLevel());
+ } else if (key.equals(Grid.KEY_COL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getColumnSpan(), grid2.getColumnSpan());
+ } else if (key.equals(Grid.KEY_ROW_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
+ } else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
index 620868b40..aa49bf0ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -27,6 +31,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
msg.setDistanceUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setTemperatureUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setDisplayModeUnitAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -38,12 +43,14 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable();
Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable();
Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
@@ -53,6 +60,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getDistanceUnitAvailable());
assertNull(Test.NULL, msg.getTemperatureUnitAvailable());
assertNull(Test.NULL, msg.getDisplayModeUnitAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -63,6 +71,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -70,8 +79,15 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(HMISettingsControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
index 2609acd37..68baaba62 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
@@ -67,4 +67,26 @@ public class ImageResolutionTests extends TestCase{
fail(Test.JSON_FAIL);
}
}
+
+ public void testSetResolutionWidth_Odd() {
+ msg.setResolutionWidth(175);
+ assertEquals(176, (int)msg.getResolutionWidth());
+ }
+
+ public void testSetResolutionHeight_Odd() {
+ msg.setResolutionHeight(175);
+ assertEquals(176, (int)msg.getResolutionHeight());
+ }
+
+ public void testSetResolutionWidth_Pair() {
+ msg.setResolutionWidth(176);
+ assertEquals(176, (int)msg.getResolutionWidth());
+
+ }
+
+ public void testSetResolutionHeight_Pair() {
+ msg.setResolutionHeight(176);
+ assertEquals(176, (int)msg.getResolutionHeight());
+
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
index 4ebd7f467..ad6e5a4ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
import com.smartdevicelink.test.Validator;
@@ -13,6 +14,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +32,7 @@ public class LightControlCapabilitiesTests extends TestCase {
msg.setModuleName(Test.GENERAL_STRING);
msg.setSupportedLights(Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -39,10 +42,12 @@ public class LightControlCapabilitiesTests extends TestCase {
// Test Values
String moduleName = msg.getModuleName();
List<LightCapabilities> supportedLights = msg.getSupportedLights();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertTrue(Test.TRUE, Validator.validateLightCapabilitiesList(Test.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
@@ -52,6 +57,7 @@ public class LightControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getModuleName());
assertNull(Test.NULL, msg.getSupportedLights());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -60,6 +66,7 @@ public class LightControlCapabilitiesTests extends TestCase {
try {
reference.put(LightControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ reference.put(LightControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -75,7 +82,14 @@ public class LightControlCapabilitiesTests extends TestCase {
for (LightCapabilities lc : lcReference) {
assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
}
- } else {
+ } else if(key.equals(LightControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ }
+ else {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
index b553587ad..7f4a78b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
@@ -39,6 +39,7 @@ public class ModuleDataTests extends TestCase {
msg.setAudioControlData(Test.GENERAL_AUDIOCONTROLDATA);
msg.setHmiSettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA);
msg.setLightControlData(Test.GENERAL_LIGHTCONTROLDATA);
+ msg.setModuleId(Test.GENERAL_STRING);
}
/**
@@ -53,6 +54,7 @@ public class ModuleDataTests extends TestCase {
AudioControlData audioControlData = msg.getAudioControlData();
HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData();
LightControlData lightControlData = msg.getLightControlData();
+ String moduleId = msg.getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType);
@@ -62,6 +64,7 @@ public class ModuleDataTests extends TestCase {
assertTrue(Test.TRUE, Validator.validateAudioControlData(Test.GENERAL_AUDIOCONTROLDATA, audioControlData));
assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
assertTrue(Test.TRUE, Validator.validateLightControlData(Test.GENERAL_LIGHTCONTROLDATA, lightControlData));
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleId);
// Invalid/Null Tests
ModuleData msg = new ModuleData();
@@ -74,6 +77,7 @@ public class ModuleDataTests extends TestCase {
assertNull(Test.NULL, msg.getAudioControlData());
assertNull(Test.NULL, msg.getHmiSettingsControlData());
assertNull(Test.NULL, msg.getLightControlData());
+ assertNull(Test.NULL, msg.getModuleId());
}
public void testJson() {
@@ -87,6 +91,7 @@ public class ModuleDataTests extends TestCase {
reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_AUDIOCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_MODULE_ID, Test.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
new file mode 100644
index 000000000..282e43b4f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
@@ -0,0 +1,70 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ModuleInfoTests extends TestCase {
+ private ModuleInfo msg;
+
+ @Override
+ public void setUp() {
+ msg = new ModuleInfo();
+ msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleLocation(Test.GENERAL_GRID);
+ msg.setModuleServiceArea(Test.GENERAL_GRID);
+ msg.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
+ }
+
+ public void testRpcValues() {
+ String id = msg.getModuleId();
+ Grid loc = msg.getModuleLocation();
+ Grid area = msg.getModuleServiceArea();
+ boolean isAllowed = msg.getMultipleAccessAllowance();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, loc);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, area);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isAllowed);
+
+ //null test
+ ModuleInfo msg = new ModuleInfo();
+ assertNull(Test.NULL, msg.getModuleId());
+ assertNull(Test.NULL, msg.getModuleLocation());
+ assertNull(Test.NULL, msg.getModuleServiceArea());
+ assertNull(Test.NULL, msg.getMultipleAccessAllowance());
+
+ //test required params constructor
+ ModuleInfo msg2 = new ModuleInfo(Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, msg2.getModuleId(), Test.GENERAL_STRING);
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(Test.MATCH, original.length(), serialized.length());
+
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
index a525bdb23..a65a7deef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -36,6 +40,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
msg.setHdRadioEnableAvailable(Test.GENERAL_BOOLEAN);
msg.setSiriusXMRadioAvailable(Test.GENERAL_BOOLEAN);
msg.setSisDataAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
msg.setAvailableHdChannelsAvailable(Test.GENERAL_BOOLEAN);
}
@@ -57,6 +62,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
boolean hdRadioEnableAvailable = msg.getHdRadioEnableAvailable();
boolean siriusXMRadioAvailable = msg.getSiriusXMRadioAvailable();
boolean sisDataAvailable = msg.getSisDataAvailable();
+ ModuleInfo info = msg.getModuleInfo();
boolean availableHdChannelsAvailable = msg.getAvailableHdChannelsAvailable();
@@ -74,6 +80,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, siriusXMRadioAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sisDataAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHdChannelsAvailable);
// Invalid/Null Tests
@@ -93,6 +100,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHdRadioEnableAvailable());
assertNull(Test.NULL, msg.getSiriusXMRadioAvailable());
assertNull(Test.NULL, msg.getSisDataAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
assertNull(Test.NULL, msg.getAvailableHdChannelsAvailable());
}
@@ -113,6 +121,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
@@ -121,8 +130,15 @@ public class RadioControlCapabilitiesTests extends TestCase{
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(RadioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
new file mode 100644
index 000000000..847564adb
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
@@ -0,0 +1,99 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.proxy.rpc.SeatLocationCapability;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+public class SeatLocationCapabilityTests extends TestCase {
+
+ private SeatLocationCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocationCapability();
+ msg.setCols(Test.GENERAL_INT);
+ msg.setRows(Test.GENERAL_INT);
+ msg.setLevels(Test.GENERAL_INT);
+ msg.setSeats(Test.GENERAL_SEAT_LIST);
+ }
+
+ public void testRpcValues() {
+ int row = msg.getRows();
+ int col = msg.getCols();
+ int level = msg.getLevels();
+ List<SeatLocation> seats = msg.getSeatLocations();
+
+ //valid tests
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, seats.size(), Test.GENERAL_SEAT_LIST.size());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateGrid(Test.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
+ }
+
+ //null tests
+ SeatLocationCapability msg = new SeatLocationCapability();
+ assertNull(Test.NULL, msg.getCols());
+ assertNull(Test.NULL, msg.getRows());
+ assertNull(Test.NULL, msg.getLevels());
+ assertNull(Test.NULL, msg.getSeatLocations());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocationCapability.KEY_COLS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_ROWS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_LEVELS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_SEATS, Test.JSON_SEAT_LOCATIONS);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ while (iter.hasNext()) {
+ key = iter.next();
+ if (key.equals(SeatLocationCapability.KEY_COLS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getCols();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getCols();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_ROWS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getRows();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getRows();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_LEVELS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getLevels();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getLevels();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
+ JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
+ JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
+ assertEquals(Test.MATCH, arr1.length(), arr2.length());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
+ assertTrue(Test.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
new file mode 100644
index 000000000..6a102fc66
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class SeatLocationTests extends TestCase {
+
+ private SeatLocation msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocation();
+ msg.setGrid(Test.GENERAL_GRID);
+ }
+
+ public void testRpcValues() {
+ Grid grid = msg.getGrid();
+
+ //valid test
+ assertTrue(Validator.validateGrid(Test.GENERAL_GRID, grid));
+
+ //null test
+ SeatLocation msg = new SeatLocation();
+ assertNull(Test.NULL, msg.getGrid());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocation.KEY_GRID, Test.GENERAL_GRID);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+ assertTrue(Test.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
+ new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
index f5d0a9217..b422ce627 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
@@ -27,6 +27,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
msg.setLongPressAvailable(Test.GENERAL_BOOLEAN);
msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
+ msg.setTextSupported(Test.GENERAL_BOOLEAN);
}
/**
@@ -38,12 +39,14 @@ public class SoftButtonCapabilitiesTest extends TestCase {
Boolean updown = msg.getUpDownAvailable();
Boolean longPress = msg.getLongPressAvailable();
Boolean shortPress = msg.getShortPressAvailable();
+ Boolean textSupported = msg.getTextSupported();
// Valid Tests
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, imageSupp);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, updown);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, longPress);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, shortPress);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, textSupported);
// Invalid/Null Tests
SoftButtonCapabilities msg = new SoftButtonCapabilities();
@@ -53,6 +56,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
assertNull(Test.NULL, msg.getLongPressAvailable());
assertNull(Test.NULL, msg.getShortPressAvailable());
assertNull(Test.NULL, msg.getUpDownAvailable());
+ assertNull(Test.NULL, msg.getTextSupported());
}
public void testJson() {
@@ -63,6 +67,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
index bc50907db..c6a3cfa0e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -4,6 +4,7 @@ import android.util.Log;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
@@ -12,14 +13,13 @@ import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
import com.smartdevicelink.test.Validator;
-
import junit.framework.TestCase;
-
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -38,7 +38,7 @@ public class SystemCapabilityTests extends TestCase {
msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES);
msg.setCapabilityForType(SystemCapabilityType.APP_SERVICES, Test.GENERAL_APP_SERVICE_CAPABILITIES);
-
+ msg.setCapabilityForType(SystemCapabilityType.DISPLAYS, Test.GENERAL_DISPLAYCAPABILITY_LIST);
}
/**
@@ -51,6 +51,7 @@ public class SystemCapabilityTests extends TestCase {
PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL);
RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL);
AppServicesCapabilities testAppServicesCapabilities = (AppServicesCapabilities) msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES);
+ List<DisplayCapability> displayCapabilities = (List<DisplayCapability>) msg.getCapabilityForType(SystemCapabilityType.DISPLAYS);
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
@@ -59,6 +60,10 @@ public class SystemCapabilityTests extends TestCase {
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities(Test.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities(Test.GENERAL_APP_SERVICE_CAPABILITIES, testAppServicesCapabilities));
+ for(int i = 0; i < Test.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++){
+ assertTrue(Test.TRUE, Validator.validateDisplayCapability(Test.GENERAL_DISPLAYCAPABILITY_LIST.get(i), displayCapabilities.get(i)));
+ }
+
// Invalid/Null Tests
SystemCapability msg = new SystemCapability();
assertNotNull(Test.NOT_NULL, msg);
@@ -68,6 +73,7 @@ public class SystemCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES));
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.DISPLAYS));
}
public void testJson() {
@@ -79,6 +85,7 @@ public class SystemCapabilityTests extends TestCase {
reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_PHONECAPABILITY.getStore()));
reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
reference.put(SystemCapability.KEY_APP_SERVICES_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_CAPABILITIES.getStore()));
+ reference.put(SystemCapability.KEY_DISPLAY_CAPABILITIES, Test.JSON_DISPLAYCAPABILITY_LIST);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -105,7 +112,7 @@ public class SystemCapabilityTests extends TestCase {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
- }else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
+ } else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
@@ -113,6 +120,16 @@ public class SystemCapabilityTests extends TestCase {
Log.i("TEST REF", hashReference.toString());
Log.i("TEST TEST", hashTest.toString());
assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
+ } else if(key.equals(SystemCapability.KEY_DISPLAY_CAPABILITIES)){
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for(int i = 0; i < referenceArray.length(); i++){
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateDisplayCapability(new DisplayCapability(hashReference), new DisplayCapability(hashTest)));
+ }
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
new file mode 100644
index 000000000..fe505218c
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
@@ -0,0 +1,91 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import junit.framework.TestCase;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.TemplateConfiguration}
+ */
+public class TemplateConfigurationTests extends TestCase {
+
+ private TemplateConfiguration msg;
+
+ @Override
+ public void setUp(){
+ msg = new TemplateConfiguration();
+
+ msg.setTemplate(Test.GENERAL_STRING);
+ msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String testTemplate = msg.getTemplate();
+ TemplateColorScheme testDayColorScheme = msg.getDayColorScheme();
+ TemplateColorScheme testNightColorScheme = msg.getNightColorScheme();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testTemplate);
+ assertEquals(Test.MATCH, Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme);
+ assertEquals(Test.MATCH, Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme);
+
+ // Invalid/Null Tests
+ TemplateConfiguration msg = new TemplateConfiguration();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getTemplate());
+ assertNull(Test.NULL, msg.getDayColorScheme());
+ assertNull(Test.NULL, msg.getNightColorScheme());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(TemplateConfiguration.KEY_TEMPLATE, Test.GENERAL_STRING);
+ reference.put(TemplateConfiguration.KEY_DAY_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_DAYCOLORSCHEME.getStore()));
+ reference.put(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NIGHTCOLORSCHEME.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if (key.equals(TemplateConfiguration.KEY_DAY_COLOR_SCHEME)) {
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ } else if (key.equals(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME)) {
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
index 5b982fe97..dd84c8181 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
@@ -23,6 +23,7 @@ public class VehicleDataResultTest extends TestCase {
msg.setDataType(Test.GENERAL_VEHICLEDATATYPE);
msg.setResultCode(Test.GENERAL_VEHICLEDATARESULTCODE);
+ msg.setOEMCustomVehicleDataType(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
}
/**
@@ -32,10 +33,12 @@ public class VehicleDataResultTest extends TestCase {
// Test Values
VehicleDataResultCode result = msg.getResultCode();
VehicleDataType type = msg.getDataType();
+ String oemCustomDataType = msg.getOEMCustomVehicleDataType();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATARESULTCODE, result);
assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATATYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
// Invalid/Null Tests
VehicleDataResult msg = new VehicleDataResult();
@@ -43,6 +46,7 @@ public class VehicleDataResultTest extends TestCase {
assertNull(Test.NULL, msg.getDataType());
assertNull(Test.NULL, msg.getResultCode());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleDataType());
}
public void testJson() {
@@ -51,6 +55,7 @@ public class VehicleDataResultTest extends TestCase {
try {
reference.put(VehicleDataResult.KEY_RESULT_CODE, Test.GENERAL_VEHICLEDATARESULTCODE);
reference.put(VehicleDataResult.KEY_DATA_TYPE, Test.GENERAL_VEHICLEDATATYPE);
+ reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 54cfc1a22..808429d2f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -30,6 +30,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
msg.setMaxBitrate(Test.GENERAL_INT);
msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
+ msg.setDiagonalScreenSize(Test.GENERAL_DOUBLE);
+ msg.setPixelPerInch(Test.GENERAL_DOUBLE);
+ msg.setScale(Test.GENERAL_DOUBLE);
}
/**
@@ -41,12 +44,18 @@ public class VideoStreamingCapabilityTests extends TestCase {
ImageResolution res = msg.getPreferredResolution();
Integer maxBitrate = msg.getMaxBitrate();
Boolean isHapticSpatialDataSupported = msg.getIsHapticSpatialDataSupported();
+ Double diagonalScreenSize = msg.getDiagonalScreenSize();
+ Double pixelPerInch = msg.getPixelPerInch();
+ Double scale = msg.getScale();
// Valid Tests
assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, diagonalScreenSize);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, pixelPerInch);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, scale);
// Invalid/Null Tests
VideoStreamingCapability msg = new VideoStreamingCapability();
@@ -56,6 +65,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getPreferredResolution());
assertNull(Test.NULL, msg.getSupportedFormats());
assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
+ assertNull(Test.NULL, msg.getDiagonalScreenSize());
+ assertNull(Test.NULL, msg.getPixelPerInch());
+ assertNull(Test.NULL, msg.getScale());
}
public void testJson() {
@@ -66,6 +78,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_SCALE, Test.GENERAL_DOUBLE);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -87,6 +102,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
for(VideoStreamingFormat vsf : vsfReference){
assertTrue(Validator.validateSupportedFormats(vsf, new VideoStreamingFormat(JsonRPCMarshaller.deserializeJSONObject(vsfArray.getJSONObject(i++)))));
}
+ } else if (key.equals(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE) || key.equals(VideoStreamingCapability.KEY_PIXEL_PER_INCH) ||
+ key.equals(VideoStreamingCapability.KEY_SCALE)) {
+ assertEquals(JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key), 0.0005);
}
}
} catch (JSONException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
new file mode 100644
index 000000000..07d2cbd49
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
@@ -0,0 +1,190 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ImageField;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import junit.framework.TestCase;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WindowCapability}
+ */
+public class WindowCapabilityTests extends TestCase {
+
+ private WindowCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new WindowCapability();
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST);
+ msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST);
+ msg.setImageTypeSupported(Test.GENERAL_IMAGE_TYPE_LIST);
+ msg.setTemplatesAvailable(Test.GENERAL_STRING_LIST);
+ msg.setNumCustomPresetsAvailable(Test.GENERAL_INT);
+ msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int windowID = msg.getWindowID();
+ List<TextField> textFields = msg.getTextFields();
+ List<ImageField> imageFields = msg.getImageFields();
+ List<ImageType> imageTypeSupported = msg.getImageTypeSupported();
+ List<String> templatesAvailable = msg.getTemplatesAvailable();
+ int numCustomPresetsAvailable = msg.getNumCustomPresetsAvailable();
+ List<ButtonCapabilities> buttonCapabilities = msg.getButtonCapabilities();
+ List<SoftButtonCapabilities> softButtonCapabilities = msg.getSoftButtonCapabilities();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, windowID);
+ assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.size(), imageTypeSupported.size());
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), templatesAvailable.size());
+ assertEquals(Test.MATCH, Test.GENERAL_INT, numCustomPresetsAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), softButtonCapabilities.size());
+
+ for (int i = 0; i < Test.GENERAL_TEXTFIELD_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateTextFields(Test.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_IMAGEFIELD_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateImageFields(Test.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_IMAGE_TYPE_LIST.size(); i++) {
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.get(i), imageTypeSupported.get(i));
+ }
+
+ for (int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++) {
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
+ }
+
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, softButtonCapabilities));
+
+ // Invalid/Null Tests
+ WindowCapability msg = new WindowCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getTextFields());
+ assertNull(Test.NULL, msg.getImageFields());
+ assertNull(Test.NULL, msg.getImageTypeSupported());
+ assertNull(Test.NULL, msg.getTemplatesAvailable());
+ assertNull(Test.NULL, msg.getNumCustomPresetsAvailable());
+ assertNull(Test.NULL, msg.getButtonCapabilities());
+ assertNull(Test.NULL, msg.getSoftButtonCapabilities());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WindowCapability.KEY_WINDOW_ID, Test.GENERAL_INT);
+ reference.put(WindowCapability.KEY_TEXT_FIELDS, Test.JSON_TEXTFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_FIELDS, Test.JSON_IMAGEFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, Test.JSON_IMAGE_TYPE_SUPPORTED);
+ reference.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, Test.GENERAL_INT);
+ reference.put(WindowCapability.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
+ reference.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(WindowCapability.KEY_IMAGE_FIELDS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
+ }
+ } else if (key.equals(WindowCapability.KEY_TEXT_FIELDS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
+ }
+ } else if (key.equals(WindowCapability.KEY_TEMPLATES_AVAILABLE)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else if (key.equals(WindowCapability.KEY_BUTTON_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>();
+ List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new ButtonCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new ButtonCapabilities(hashTest));
+ }
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ } else if (key.equals(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<SoftButtonCapabilities> referenceList = new ArrayList<SoftButtonCapabilities>();
+ List<SoftButtonCapabilities> testList = new ArrayList<SoftButtonCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new SoftButtonCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new SoftButtonCapabilities(hashTest));
+ }
+ assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(referenceList, testList));
+ } else if (key.equals(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED)) {
+ List<String> referenceList = JsonUtils.readStringListFromJsonObject(reference, key);
+ List<String> underTestList = JsonUtils.readStringListFromJsonObject(underTest, key);
+
+ assertEquals(Test.MATCH, referenceList.size(), underTestList.size());
+ for (int i = 0; i < referenceList.size(); i++) {
+ assertEquals(Test.MATCH, referenceList.get(i), underTestList.get(i));
+ }
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
new file mode 100644
index 000000000..4b9c767e3
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
@@ -0,0 +1,63 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import junit.framework.TestCase;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Iterator;
+
+public class WindowTypeCapabilitiesTest extends TestCase {
+
+ private WindowTypeCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new WindowTypeCapabilities();
+
+ msg.setMaximumNumberOfWindows(Test.GENERAL_INT);
+ msg.setType(Test.GENERAL_WINDOW_TYPE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int maximumNumberOfWindows = msg.getMaximumNumberOfWindows();
+ WindowType type = msg.getType();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, maximumNumberOfWindows);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_TYPE, type);
+
+ // Invalid/Null Tests
+ WindowTypeCapabilities msg = new WindowTypeCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMaximumNumberOfWindows());
+ assertNull(Test.NULL, msg.getType());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, Test.GENERAL_INT);
+ reference.put(WindowTypeCapabilities.KEY_TYPE, Test.GENERAL_WINDOW_TYPE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
index 422ab808c..38caad109 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
@@ -32,6 +32,8 @@ public class GlobalPropertyTests extends TestCase {
GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example);
example = "KEYBOARDPROPERTIES";
GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example);
+ example = "USERLOCATION";
+ GlobalProperty enumUserLocation = GlobalProperty.valueForString(example);
assertNotNull("HELPPROMPT returned null", enumHelpPrompt);
assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt);
@@ -40,6 +42,7 @@ public class GlobalPropertyTests extends TestCase {
assertNotNull("MENUNAME returned null", enumMenuName);
assertNotNull("MENUICON returned null", enumMenuIcon);
assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
+ assertNotNull("USERLOCATION returned null", enumUserLocation);
}
/**
@@ -84,6 +87,7 @@ public class GlobalPropertyTests extends TestCase {
enumTestList.add(GlobalProperty.MENUNAME);
enumTestList.add(GlobalProperty.MENUICON);
enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES);
+ enumTestList.add(GlobalProperty.USERLOCATION);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java
new file mode 100644
index 000000000..3b37070b7
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java
@@ -0,0 +1,55 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
+import junit.framework.TestCase;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.PredefinedWindows}
+ */
+public class PredefinedWindowsTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ int example = 0;
+ PredefinedWindows enumDefaultWindow = PredefinedWindows.valueForInt(example);
+ example = 1;
+ PredefinedWindows enumPrimaryWidget = PredefinedWindows.valueForInt(example);
+
+ assertNotNull("DEFAULT_WINDOW returned null", enumDefaultWindow);
+ assertNotNull("PRIMARY_WIDGET returned null", enumPrimaryWidget);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ int example = 3;
+ try {
+ PredefinedWindows temp = PredefinedWindows.valueForInt(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of PredefinedWindows.
+ */
+ public void testListEnum() {
+ List<PredefinedWindows> enumValueList = Arrays.asList(PredefinedWindows.values());
+
+ List<PredefinedWindows> enumTestList = new ArrayList<PredefinedWindows>();
+ enumTestList.add(PredefinedWindows.DEFAULT_WINDOW);
+ enumTestList.add(PredefinedWindows.PRIMARY_WIDGET);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
index e97519881..f453cb985 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -48,8 +48,12 @@ public class SystemCapabilityTypeTests extends TestCase {
SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example);
example = "APP_SERVICES";
SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example);
+ example = "SEAT_LOCATION";
+ SystemCapabilityType enumSeatLocation = SystemCapabilityType.valueForString(example);
example = "PRERECORDED_SPEECH";
SystemCapabilityType enumPrerecordedSpeech = SystemCapabilityType.valueForString(example);
+ example = "DISPLAYS";
+ SystemCapabilityType enumDisplays = SystemCapabilityType.valueForString(example);
assertNotNull("NAVIGATION returned null", enumNavigation);
assertNotNull("PHONE_CALL returned null", enumPhoneCall);
@@ -66,7 +70,9 @@ public class SystemCapabilityTypeTests extends TestCase {
assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition);
assertNotNull("PCM_STREAMING", enumPCM);
assertNotNull("APP_SERVICES", enumAppServices);
+ assertNotNull("SEAT_LOCATION return null", enumSeatLocation);
assertNotNull("PRERECORDED_SPEECH", enumPrerecordedSpeech);
+ assertNotNull("DISPLAYS", enumDisplays);
}
/**
@@ -119,7 +125,9 @@ public class SystemCapabilityTypeTests extends TestCase {
enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION);
enumTestList.add(SystemCapabilityType.PCM_STREAMING);
enumTestList.add(SystemCapabilityType.APP_SERVICES);
+ enumTestList.add(SystemCapabilityType.SEAT_LOCATION);
enumTestList.add(SystemCapabilityType.PRERECORDED_SPEECH);
+ enumTestList.add(SystemCapabilityType.DISPLAYS);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
index 65a7646d3..dbce8b5e7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
@@ -80,6 +80,8 @@ public class VehicleDataTypeTests extends TestCase {
VehicleDataType enumVehicleDataElectronicParkBrakeStatus = VehicleDataType.valueForString(example);
example = "VEHICLEDATA_CLOUDAPPVEHICLEID";
VehicleDataType enumVehicleCloudAppVehicleId = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_OEM_CUSTOM_DATA";
+ VehicleDataType enumVehicleDataOemVehicleDataType= VehicleDataType.valueForString(example);
assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
@@ -112,6 +114,7 @@ public class VehicleDataTypeTests extends TestCase {
assertNotNull("VEHICLEDATA_TURNSIGNAL returned null", enumVehicleDataTurnSignal);
assertNotNull("VEHICLEDATA_ELECTRONICPARKBRAKESTATUS returned null", enumVehicleDataElectronicParkBrakeStatus);
assertNotNull("VEHICLEDATA_CLOUDAPPVEHICLEID returned null", enumVehicleCloudAppVehicleId);
+ assertNotNull("VEHICLEDATA_OEM_CUSTOM_DATA returned null", enumVehicleDataOemVehicleDataType);
}
/**
@@ -180,8 +183,9 @@ public class VehicleDataTypeTests extends TestCase {
enumTestList.add(VehicleDataType.VEHICLEDATA_TURNSIGNAL);
enumTestList.add(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS);
enumTestList.add(VehicleDataType.VEHICLEDATA_CLOUDAPPVEHICLEID);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_OEM_CUSTOM_DATA);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java
new file mode 100644
index 000000000..b6e26f9df
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java
@@ -0,0 +1,68 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import junit.framework.TestCase;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.WindowType}
+ */
+public class WindowTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MAIN";
+ WindowType enumMain = WindowType.valueForString(example);
+ example = "WIDGET";
+ WindowType enumWidget = WindowType.valueForString(example);
+
+ assertNotNull("MAIN returned null", enumMain);
+ assertNotNull("WIDGET returned null", enumWidget);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "mAIN";
+ try {
+ WindowType temp = WindowType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ WindowType temp = WindowType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of WindowType.
+ */
+ public void testListEnum() {
+ List<WindowType> enumValueList = Arrays.asList(WindowType.values());
+
+ List<WindowType> enumTestList = new ArrayList<WindowType>();
+ enumTestList.add(WindowType.MAIN);
+ enumTestList.add(WindowType.WIDGET);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
index 46a5d1c75..56c41b213 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
@@ -29,6 +29,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
msg.setFirstRun(Test.GENERAL_BOOLEAN);
msg.setHmiLevel(Test.GENERAL_HMILEVEL);
msg.setSystemContext(Test.GENERAL_SYSTEMCONTEXT);
+ msg.setWindowID(Test.GENERAL_INT);
return msg;
}
@@ -52,6 +53,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
result.put(OnHMIStatus.KEY_VIDEO_STREAMING_STATE, Test.GENERAL_VIDEOSTREAMINGSTATE);
result.put(OnHMIStatus.KEY_HMI_LEVEL, Test.GENERAL_HMILEVEL);
result.put(OnHMIStatus.KEY_SYSTEM_CONTEXT, Test.GENERAL_SYSTEMCONTEXT);
+ result.put(OnHMIStatus.KEY_WINDOW_ID, Test.GENERAL_INT);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -68,12 +70,14 @@ public class OnHMIStatusTests extends BaseRpcTests{
VideoStreamingState videoStreamingState = ( (OnHMIStatus) msg ).getVideoStreamingState();
HMILevel hmiLevel = ( (OnHMIStatus) msg ).getHmiLevel();
SystemContext context = ( (OnHMIStatus) msg ).getSystemContext();
+ int testWindowID = ( (OnHMIStatus) msg ).getWindowID();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_AUDIOSTREAMINGSTATE, audioStreamingState);
assertEquals(Test.MATCH, Test.GENERAL_VIDEOSTREAMINGSTATE, videoStreamingState);
assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL, hmiLevel);
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCONTEXT, context);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
// Invalid/Null Tests
OnHMIStatus msg = new OnHMIStatus();
@@ -87,5 +91,6 @@ public class OnHMIStatusTests extends BaseRpcTests{
assertEquals(Test.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
assertNull(Test.NULL, msg.getHmiLevel());
assertNull(Test.NULL, msg.getSystemContext());
+ assertNull(Test.NULL, msg.getWindowID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
index 38f55e418..e366e832f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
@@ -92,6 +92,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
result.put(OnVehicleData.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -133,6 +134,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
List<FuelRange> fuelRangeList = ( (OnVehicleData) msg).getFuelRange();
TurnSignal turnSignal = ( (OnVehicleData) msg).getTurnSignal();
ElectronicParkBrakeStatus electronicParkBrakeStatus = ( (OnVehicleData) msg).getElectronicParkBrakeStatus();
+ Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertEquals(Test.MATCH, VehicleDataHelper.SPEED, speed);
@@ -164,6 +166,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertTrue(Test.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
+ assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
// Invalid/Null Tests
OnVehicleData msg = new OnVehicleData();
@@ -199,6 +202,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
public void testJson() {
@@ -373,6 +377,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
reference.put(OnVehicleData.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
reference.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
//go inside underTest and only return the JSONObject inside the parameters key inside the notification key
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
index d4a7bd473..8bd229d4d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
@@ -39,6 +39,7 @@ public class AlertTests extends BaseRpcTests{
msg.setProgressIndicator(Test.GENERAL_BOOLEAN);
msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
msg.setAlertIcon(Test.GENERAL_IMAGE);
return msg;
@@ -67,6 +68,7 @@ public class AlertTests extends BaseRpcTests{
result.put(Alert.KEY_PROGRESS_INDICATOR, Test.GENERAL_BOOLEAN);
result.put(Alert.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
result.put(Alert.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(Alert.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
result.put(Alert.KEY_ALERT_ICON, Test.JSON_IMAGE);
}catch(JSONException e){
fail(Test.JSON_FAIL);
@@ -88,6 +90,7 @@ public class AlertTests extends BaseRpcTests{
boolean testProgressIndicator = ( (Alert) msg ).getProgressIndicator();
List<TTSChunk> testTtsChunks = ( (Alert) msg ).getTtsChunks();
List<SoftButton> testSoftButtons = ( (Alert) msg ).getSoftButtons();
+ Integer testCancelID = ( (Alert) msg ).getCancelID();
Image alertIcon = ( (Alert) msg ).getAlertIcon();
// Valid Tests
@@ -99,6 +102,7 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testProgressIndicator);
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, alertIcon));
// Invalid/Null Tests
@@ -114,6 +118,7 @@ public class AlertTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getProgressIndicator());
assertNull(Test.NULL, msg.getTtsChunks());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
assertNull(Test.NULL, msg.getAlertIcon());
}
@@ -141,6 +146,7 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_TTS_CHUNKS);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
index f16a3a87c..6f90585d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
@@ -30,6 +30,7 @@ public class ButtonPressTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
msg.setButtonName(Test.GENERAL_BUTTONNAME);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -52,6 +53,7 @@ public class ButtonPressTests extends BaseRpcTests {
result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
+ result.put(ButtonPress.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -67,11 +69,13 @@ public class ButtonPressTests extends BaseRpcTests {
ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName();
ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode();
+ String testButtonId = ((ButtonPress) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testButtonId);
// Invalid/Null Tests
ButtonPress msg = new ButtonPress();
@@ -81,6 +85,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getButtonName());
assertNull(Test.NULL, msg.getButtonPressMode());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -106,6 +111,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
new file mode 100644
index 000000000..8735bea9c
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/17/19 10:06 AM
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteraction}
+ */
+public class CancelInteractionTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ CancelInteraction msg = new CancelInteraction();
+ msg.setInteractionFunctionID(Test.GENERAL_INTEGER);
+ msg.setCancelID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(CancelInteraction.KEY_FUNCTION_ID, Test.GENERAL_INTEGER);
+ result.put(CancelInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
+ Integer testCancelID = ((CancelInteraction) msg).getCancelID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testFunctionID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
+ // Invalid/Null Tests
+ CancelInteraction msg = new CancelInteraction();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getInteractionFunctionID());
+ assertNull(Test.NULL, msg.getCancelID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteraction cmd = new CancelInteraction(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
+ }
+ catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
new file mode 100644
index 000000000..dd8264caf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
@@ -0,0 +1,120 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CreateWindow;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CreateWindow}
+ */
+public class CreateWindowTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ CreateWindow msg = new CreateWindow();
+
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setWindowName(Test.GENERAL_STRING);
+ msg.setType(Test.GENERAL_WINDOW_TYPE);
+ msg.setAssociatedServiceType(Test.GENERAL_STRING);
+ msg.setDuplicateUpdatesFromWindowID(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.CREATE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(CreateWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(CreateWindow.KEY_WINDOW_NAME, Test.GENERAL_STRING);
+ result.put(CreateWindow.KEY_TYPE, Test.GENERAL_WINDOW_TYPE);
+ result.put(CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE, Test.GENERAL_STRING);
+ result.put(CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, Test.GENERAL_INT);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int testWindowID = ((CreateWindow) msg).getWindowID();
+ String testWindowName = ((CreateWindow) msg).getWindowName();
+ WindowType testType = ((CreateWindow) msg).getType();
+ String testAssociatedServiceType = ((CreateWindow) msg).getAssociatedServiceType();
+ int testDuplicateUpdatesFromWindowID = ((CreateWindow) msg).getDuplicateUpdatesFromWindowID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testWindowName);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_TYPE, testType);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testAssociatedServiceType);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testDuplicateUpdatesFromWindowID);
+
+ // Invalid/Null Tests
+ CreateWindow msg = new CreateWindow();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getWindowName());
+ assertNull(Test.NULL, msg.getType());
+ assertNull(Test.NULL, msg.getAssociatedServiceType());
+ assertNull(Test.NULL, msg.getDuplicateUpdatesFromWindowID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CreateWindow cmd = new CreateWindow(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_WINDOW_NAME).toString(), cmd.getWindowName().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_TYPE).toString(), cmd.getType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE).toString(), cmd.getAssociatedServiceType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID), cmd.getDuplicateUpdatesFromWindowID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
new file mode 100644
index 000000000..3602d2d62
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DeleteWindow;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DeleteWindow}
+ */
+public class DeleteWindowTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ DeleteWindow msg = new DeleteWindow();
+
+ msg.setWindowID(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.DELETE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(DeleteWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int testWindowID = ((DeleteWindow) msg).getWindowID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+
+ // Invalid/Null Tests
+ DeleteWindow msg = new DeleteWindow();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteWindow cmd = new DeleteWindow(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
new file mode 100644
index 000000000..d736e5176
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsent;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleIds(Test.GENERAL_STRING_LIST);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
+ List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, ids);
+
+ //null tests
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleIds());
+
+ //test require param constructor
+ GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(Test.GENERAL_MODULETYPE, Test.GENERAL_STRING_LIST);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, msg2.getModuleIds());
+
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
index 5a08d4266..dd175ae6f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
@@ -27,6 +27,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -48,6 +49,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
try{
result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleData.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -62,10 +64,12 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
// Test Values
ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe();
+ String testModuleId = ((GetInteriorVehicleData) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testModuleId);
// Invalid/Null Tests
GetInteriorVehicleData msg = new GetInteriorVehicleData();
@@ -74,6 +78,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getSubscribe());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -98,6 +103,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
index e47560a7c..99577fb46 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
@@ -53,6 +53,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_BOOLEAN);
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -101,6 +102,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
result.put(GetVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -143,6 +145,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getFuelRange());
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getTurnSignal());
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleData msg = new GetVehicleData();
@@ -178,6 +181,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -228,6 +232,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
index e415d8382..cd3ea00b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.PerformInteraction}
+ * {@link com.smartdevicelink.proxy.rpc.PerformInteraction}
*/
public class PerformInteractionTests extends BaseRpcTests {
@@ -41,6 +41,7 @@ public class PerformInteractionTests extends BaseRpcTests {
msg.setInitialText(Test.GENERAL_STRING);
msg.setInteractionMode(Test.GENERAL_INTERACTIONMODE);
msg.setTimeout(Test.GENERAL_INT);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -68,7 +69,8 @@ public class PerformInteractionTests extends BaseRpcTests {
result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, Test.GENERAL_LAYOUTMODE);
result.put(PerformInteraction.KEY_INITIAL_TEXT, Test.GENERAL_STRING);
result.put(PerformInteraction.KEY_INTERACTION_MODE, Test.GENERAL_INTERACTIONMODE);
- result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -90,6 +92,7 @@ public class PerformInteractionTests extends BaseRpcTests {
String testInitialText = ( (PerformInteraction) msg).getInitialText();
InteractionMode testMode = ( (PerformInteraction) msg).getInteractionMode();
Integer testTimeout = ( (PerformInteraction) msg).getTimeout();
+ Integer testCancelID = ( (PerformInteraction) msg ).getCancelID();
// Valid Tests
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
@@ -101,6 +104,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_STRING, testInitialText);
assertEquals(Test.MATCH, Test.GENERAL_INTERACTIONMODE, testMode);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invald/Null Tests
PerformInteraction msg = new PerformInteraction();
@@ -117,6 +121,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getInitialText());
assertNull(Test.NULL, msg.getInteractionMode());
assertNull(Test.NULL, msg.getTimeout());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -140,6 +145,7 @@ public class PerformInteractionTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_CANCEL_ID), cmd.getCancelID());
List<Integer> interactionIDList = JsonUtils.readIntegerListFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST);
List<Integer> testIDList = cmd.getInteractionChoiceSetIDList();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
new file mode 100644
index 000000000..c2bd3b3d6
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModule;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleId(Test.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, Test.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
+ String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+
+ //null tests
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleId());
+
+ // required param tests
+ ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(Test.GENERAL_MODULETYPE);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
index 2a4e14a6a..195cb7973 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
@@ -21,7 +21,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.ScrollableMessage}
+ * {@link com.smartdevicelink.proxy.rpc.ScrollableMessage}
*/
public class ScrollableMessageTests extends BaseRpcTests {
@@ -32,6 +32,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
msg.setScrollableMessageBody(Test.GENERAL_STRING);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -53,7 +54,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
try {
result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, Test.GENERAL_STRING);
result.put(ScrollableMessage.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -69,6 +71,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
String testBody = ( (ScrollableMessage) msg ).getScrollableMessageBody();
Integer testTimeout = ( (ScrollableMessage) msg ).getTimeout();
List<SoftButton> testSoftButtons = ( (ScrollableMessage) msg ).getSoftButtons();
+ Integer testCancelID = ( (ScrollableMessage) msg ).getCancelID();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testBody);
@@ -77,7 +80,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
for (int i = 0; i < Test.GENERAL_SOFTBUTTON_LIST.size(); i++) {
assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
}
-
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
// Invalid/Null Tests
ScrollableMessage msg = new ScrollableMessage();
assertNotNull(Test.NOT_NULL, msg);
@@ -87,6 +91,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getScrollableMessageBody());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -110,6 +115,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ScrollableMessage.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
index 7f08fb332..f56cab807 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
@@ -19,7 +19,7 @@ import java.util.Hashtable;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayout}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayout}
*/
public class SetDisplayLayoutTests extends BaseRpcTests {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
new file mode 100644
index 000000000..07ff2fbfc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 2:27 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.ShowAppMenu}
+ */
+public class ShowAppMenuTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ShowAppMenu msg = new ShowAppMenu();
+ msg.setMenuID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ShowAppMenu.KEY_MENU_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer copy = ( (ShowAppMenu) msg ).getMenuID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, copy);
+
+ // Invalid/Null Tests
+ ShowAppMenu msg = new ShowAppMenu();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getMenuID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenu cmd = new ShowAppMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ Integer serviceID = JsonUtils.readIntegerFromJsonObject(parameters, ShowAppMenu.KEY_MENU_ID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, serviceID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
index 4f89763aa..77f6e65e7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
@@ -7,6 +7,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
@@ -45,6 +46,8 @@ public class ShowTests extends BaseRpcTests {
msg.setCustomPresets(Test.GENERAL_STRING_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
msg.setMetadataTags(Test.GENERAL_METADATASTRUCT);
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setTemplateConfiguration(Test.GENERAL_TEMPLATE_CONFIGURATION);
return msg;
}
@@ -77,6 +80,8 @@ public class ShowTests extends BaseRpcTests {
result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Show.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
result.put(Show.KEY_METADATA_TAGS, Test.GENERAL_METADATASTRUCT.serializeJSON());
+ result.put(Show.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(Show.KEY_TEMPLATE_CONFIGURATION, Test.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -133,6 +138,8 @@ public class ShowTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getTemplateTitle());
assertNull(Test.NULL, msg.getSoftButtons());
assertNull(Test.NULL, msg.getMetadataTags());
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getTemplateConfiguration());
}
/**
@@ -173,6 +180,11 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Show.KEY_WINDOW_ID), cmd.getWindowID());
+
+ JSONObject templateConfiguration = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_TEMPLATE_CONFIGURATION);
+ TemplateConfiguration refTemplateConfiguration = new TemplateConfiguration(JsonRPCMarshaller.deserializeJSONObject(templateConfiguration));
+ assertTrue(Test.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
index 12119b847..cce913632 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
@@ -18,7 +18,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Slider}
+ * {@link com.smartdevicelink.proxy.rpc.Slider}
*/
public class SliderTests extends BaseRpcTests {
@@ -31,6 +31,7 @@ public class SliderTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSliderHeader(Test.GENERAL_STRING);
msg.setSliderFooter(Test.GENERAL_STRING_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -54,7 +55,8 @@ public class SliderTests extends BaseRpcTests {
result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Slider.KEY_POSITION, Test.GENERAL_INT);
result.put(Slider.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -72,13 +74,15 @@ public class SliderTests extends BaseRpcTests {
Integer testPosition = ( (Slider) msg ).getPosition();
String testSlider = ( (Slider) msg ).getSliderHeader();
List<String> testFooter = ( (Slider) msg ).getSliderFooter();
-
+ Integer testCancelID = ( (Slider) msg ).getCancelID();
+
// Valid Tests
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testNumTicks);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testPosition);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testSlider);
assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testFooter));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
Slider msg = new Slider();
@@ -90,6 +94,7 @@ public class SliderTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getPosition());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getNumTicks());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -121,6 +126,7 @@ public class SliderTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
}
catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
index a629f18b8..6cfeb8816 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
@@ -52,6 +52,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_BOOLEAN);
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -99,6 +100,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
result.put(SubscribeVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -140,6 +142,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getFuelRange());
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getTurnSignal());
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleData msg = new SubscribeVehicleData();
@@ -174,6 +177,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -223,6 +227,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
index 975a452db..634bb8ee6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
@@ -54,6 +54,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
msg.setCloudAppVehicleID(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -102,6 +103,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
result.put(UnsubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -143,6 +145,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getTurnSignal());
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getCloudAppVehicleID());
+ assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
@@ -178,6 +181,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
assertNull(Test.NULL, msg.getCloudAppVehicleID());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -228,6 +232,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
catch (JSONException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
new file mode 100644
index 000000000..e983327f2
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:35 AM
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteractionResponse}
+ */
+public class CancelInteractionResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new CancelInteractionResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ CancelInteractionResponse msg = new CancelInteractionResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteractionResponse cmd = new CancelInteractionResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
new file mode 100644
index 000000000..6bbdb1e6b
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
@@ -0,0 +1,72 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CreateWindowResponse}
+ */
+public class CreateWindowResponseTest extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new CreateWindowResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.CREATE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ CreateWindowResponse msg = new CreateWindowResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CreateWindowResponse cmd = new CreateWindowResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
new file mode 100644
index 000000000..145f432f3
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
@@ -0,0 +1,72 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DeleteWindowResponse}
+ */
+public class DeleteWindowResponseTest extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new DeleteWindowResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.DELETE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ DeleteWindowResponse msg = new DeleteWindowResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteWindowResponse cmd = new DeleteWindowResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
new file mode 100644
index 000000000..b96306c62
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
@@ -0,0 +1,83 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
+ msg.setAllowances(Test.GENERAL_BOOLEAN_LIST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_BOOLEAN_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ public void testRpcValues() {
+ List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
+ assertEquals(Test.MATCH, list, Test.GENERAL_BOOLEAN_LIST);
+ }
+
+ public void testRequiredParams(){
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(true, Result.SUCCESS, Test.GENERAL_BOOLEAN_LIST);
+ assertEquals(Test.MATCH, msg.getAllowances(), Test.GENERAL_BOOLEAN_LIST);
+ assertTrue(msg.getSuccess());
+ assertEquals(Test.MATCH, msg.getResultCode(), Result.SUCCESS);
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
+ GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
index 34c4a2711..fbba38025 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
@@ -90,6 +90,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
result.put(GetVehicleDataResponse.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -268,6 +269,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
reference.put(GetVehicleDataResponse.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, TurnSignal.OFF);
reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
@@ -450,6 +452,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(Test.MATCH, VehicleDataHelper.MY_KEY, ( (GetVehicleDataResponse) msg ).getMyKey());
assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, ( (GetVehicleDataResponse) msg ).getTurnSignal());
assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ( (GetVehicleDataResponse) msg ).getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleDataResponse msg = new GetVehicleDataResponse();
@@ -483,6 +486,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getMyKey());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -571,6 +575,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
new file mode 100644
index 000000000..f1d2b6e5a
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
@@ -0,0 +1,56 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse();
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
index ec0bef668..f6ea2e691 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayoutResponse}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse}
*/
public class SetDisplayLayoutResponseTest extends BaseRpcTests {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
new file mode 100644
index 000000000..397bf43cc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 2:28 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ShowAppMenuResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new ShowAppMenuResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ ShowAppMenuResponse msg = new ShowAppMenuResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
index f121d783c..88eb20221 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
@@ -57,6 +57,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -109,6 +110,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -149,6 +151,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (SubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (SubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (SubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
+ VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
@@ -179,6 +182,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(Test.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
@@ -213,6 +217,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -346,6 +351,10 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
JSONObject electronicParkBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(electronicParkBrakeStatus));
assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
+ assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
index 2df9250eb..c2ba6e019 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
@@ -59,6 +59,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -111,6 +112,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -151,6 +153,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (UnsubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (UnsubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (UnsubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
+ VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
@@ -181,6 +184,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(Test.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
@@ -215,6 +219,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -348,6 +353,10 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
JSONObject eBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eBrakeStatus));
assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
+ assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
index 457bd9a46..cbd45c49a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
@@ -45,6 +45,7 @@ import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitor;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.MediaStreamingStatus;
import com.smartdevicelink.util.Version;
@@ -82,8 +83,14 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
}
+ public SdlSession2(ISdlConnectionListener listener, TCPTransportConfig config){ //TODO is it better to have two constructors or make it take BaseTransportConfig?
+ this.transportConfig = config;
+ this.sessionListener = listener;
+ this.sdlProtocol = new SdlProtocol(this,config);
+ }
+
boolean isAudioRequirementMet(){
- if(mediaStreamingStatus == null){
+ if(mediaStreamingStatus == null && contextWeakReference!= null && contextWeakReference.get() != null){
mediaStreamingStatus = new MediaStreamingStatus(contextWeakReference.get(), new MediaStreamingStatus.Callback() {
@Override
public void onAudioNoLongerAvailable() {
@@ -304,7 +311,15 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
}else if(SessionType.PCM.equals(serviceType)){
stopAudioStream();
}
-
+ // Notify any listeners of the service being ended
+ if(serviceListeners != null && serviceListeners.containsKey(serviceType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
+ if (listeners != null && listeners.size() > 0) {
+ for (ISdlServiceListener listener : listeners) {
+ listener.onServiceEnded(this, serviceType);
+ }
+ }
+ }
}
@Override
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
index 9a6e44897..716fc16fc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
@@ -28,6 +28,8 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -59,8 +61,8 @@ public class HapticInterfaceManager {
*/
public void setHapticData(List<HapticRect> hapticData) {
userHapticData = hapticData;
- ISdl proxy = proxyHolder.get();
- if (proxy != null) {
+ if(proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
SendHapticData msg = new SendHapticData();
msg.setHapticRectData(userHapticData);
proxy.sendRPCRequest(msg);
@@ -75,15 +77,17 @@ public class HapticInterfaceManager {
* the root or parent View
*/
public void refreshHapticData(View root) {
- ISdl proxy = proxyHolder.get();
- if ((userHapticData == null) && (proxy != null)) {
- List<HapticRect> hapticRects = new ArrayList<>();
- findHapticRects(root, hapticRects);
+ if(proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
+ if (userHapticData == null) {
+ List<HapticRect> hapticRects = new ArrayList<>();
+ findHapticRects(root, hapticRects);
- SendHapticData msg = new SendHapticData();
- msg.setHapticRectData(hapticRects);
+ SendHapticData msg = new SendHapticData();
+ msg.setHapticRectData(hapticRects);
- proxy.sendRPCRequest(msg);
+ proxy.sendRPC(msg);
+ }
}
}
@@ -91,6 +95,17 @@ public class HapticInterfaceManager {
List<View> focusables = new ArrayList<>();
getFocusableViews(root, focusables);
+ double scale = 1.0;
+
+ if (proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
+ VideoStreamingCapability videoStreamingCapability = (VideoStreamingCapability)
+ proxy.getCapability(SystemCapabilityType.VIDEO_STREAMING);
+ if (videoStreamingCapability != null && videoStreamingCapability.getScale() != null) {
+ scale = videoStreamingCapability.getScale();
+ }
+ }
+
int [] loc = new int[2];
int id = 0;
for (View view : focusables) {
@@ -99,10 +114,10 @@ public class HapticInterfaceManager {
view.getLocationOnScreen(loc);
Rectangle rect = new Rectangle();
- rect.setWidth((float) w);
- rect.setHeight((float) h);
- rect.setX((float) loc[0]);
- rect.setY((float) loc[1]);
+ rect.setWidth((float) (w * scale));
+ rect.setHeight((float) (h * scale));
+ rect.setX((float) (loc[0] * scale));
+ rect.setY((float) (loc[1] * scale));
HapticRect hapticRect = new HapticRect();
hapticRect.setId(id++);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index fc204df49..23c37bea5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -44,13 +44,16 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
@@ -59,6 +62,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -93,6 +97,7 @@ import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -103,6 +108,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -574,6 +580,16 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onCreateWindowResponse(CreateWindowResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onDeleteWindowResponse(DeleteWindowResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onButtonPressResponse(ButtonPressResponse response) {
onRPCReceived(response);
@@ -609,7 +625,8 @@ public class ProxyBridge implements IProxyListener{
public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
onRPCReceived(response);
}
-@Override
+
+ @Override
public void onPublishAppServiceResponse(PublishAppServiceResponse response){
onRPCReceived(response);
}
@@ -635,6 +652,16 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){
onRPCReceived(notification);
}
@@ -645,6 +672,16 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onCancelInteractionResponse(CancelInteractionResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onShowAppMenuResponse(ShowAppMenuResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response) {
onRPCReceived(response);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index d4eda9630..b4b66bfc5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -35,6 +35,8 @@ package com.smartdevicelink.managers;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
@@ -43,6 +45,7 @@ import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.audio.AudioStreamManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.managers.lockscreen.LockScreenManager;
import com.smartdevicelink.managers.permission.PermissionManager;
@@ -52,6 +55,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
@@ -61,6 +65,7 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.ChangeRegistration;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
@@ -69,12 +74,14 @@ import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
@@ -86,6 +93,8 @@ import com.smartdevicelink.transport.utl.TransportRecord;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
+import org.json.JSONException;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -126,12 +135,16 @@ public class SdlManager extends BaseSdlManager{
@Override
public void onProxyConnected() {
DebugTool.logInfo("Proxy is connected. Now initializing.");
+ changeRegistrationRetry = 0;
+ checkLifecycleConfiguration();
initialize();
}
@Override
public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason){
- dispose();
+ if (!reason.equals(SdlDisconnectedReason.LANGUAGE_CHANGE)){
+ dispose();
+ }
}
@Override
@@ -226,6 +239,71 @@ public class SdlManager extends BaseSdlManager{
}
@Override
+ protected void checkLifecycleConfiguration(){
+ final Language actualLanguage = this.getRegisterAppInterfaceResponse().getLanguage();
+
+ if (!actualLanguage.equals(hmiLanguage)) {
+
+ final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
+
+ if (lcu != null) {
+ ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
+ changeRegistration.setAppName(lcu.getAppName());
+ changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
+ changeRegistration.setTtsName(lcu.getTtsName());
+ changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
+ changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ // go through and change sdlManager properties that were changed via the LCU update
+ hmiLanguage = actualLanguage;
+
+ if (lcu.getAppName() != null) {
+ appName = lcu.getAppName();
+ }
+
+ if (lcu.getShortAppName() != null) {
+ shortAppName = lcu.getShortAppName();
+ }
+
+ if (lcu.getTtsName() != null) {
+ ttsChunks = lcu.getTtsName();
+ }
+
+ if (lcu.getVoiceRecognitionCommandNames() != null) {
+ vrSynonyms = lcu.getVoiceRecognitionCommandNames();
+ }
+ }
+ try {
+ DebugTool.logInfo(response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Change Registration onError: " + resultCode + " | Info: " + info);
+ changeRegistrationRetry++;
+ if (changeRegistrationRetry < MAX_RETRY) {
+ final Handler handler = new Handler(Looper.getMainLooper());
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ checkLifecycleConfiguration();
+ DebugTool.logInfo("Retry Change Registration Count: " + changeRegistrationRetry);
+ }
+ }, 3000);
+ }
+ }
+ });
+ this.sendRPC(changeRegistration);
+ }
+ }
+ }
+
+ @Override
protected void initialize(){
// Instantiate sub managers
this.permissionManager = new PermissionManager(_internalInterface);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index 5a59604cc..d27ac27b5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -32,6 +32,9 @@
package com.smartdevicelink.managers;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+
public interface SdlManagerListener extends BaseSdlManagerListener{
/**
@@ -50,4 +53,17 @@ public interface SdlManagerListener extends BaseSdlManagerListener{
* @param e the exception
*/
void onError(String info, Exception e);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
index 857b26b92..55bff7bba 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
@@ -56,6 +56,7 @@ import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.transport.utl.TransportRecord;
@@ -160,7 +161,11 @@ public class AudioStreamManager extends BaseAudioStreamManager {
@Override
public void onNotified(RPCNotification notification) {
if(notification != null){
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
if(hmiLevel.equals(HMILevel.HMI_FULL) || hmiLevel.equals(HMILevel.HMI_LIMITED)){
checkState();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
index c5c0027ad..6769db0fc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
@@ -32,6 +32,11 @@
package com.smartdevicelink.managers.lockscreen;
+import android.support.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* <strong>LockScreenConfig</strong> <br>
*
@@ -47,16 +52,39 @@ package com.smartdevicelink.managers.lockscreen;
* <li> customView - If you would like to provide your own view, you can pass it in here.</li>
*
* <li> deviceLogo - On by default. If available, will show the device or OEMs logo on the lockscreen</li>
+ *
+ * <li> displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.</li>
+ *
+ * <li> enableDismissGesture - If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.</li>
*/
public class LockScreenConfig {
- private boolean enable, deviceLogo;
+ private boolean enable, deviceLogo, enableDismissGesture;
private int backgroundColor, appIconInt, customViewInt;
+ private @DisplayMode int displayMode;
+
+ /**
+ * DISPLAY_MODE_NEVER - The lock screen should never be shown. This should almost always mean that you will build your own lock screen.
+ * DISPLAY_MODE_REQUIRED_ONLY - The lock screen should only be shown when it is required by the head unit.
+ * DISPLAY_MODE_OPTIONAL_OR_REQUIRED - The lock screen should be shown when required by the head unit or when the head unit says that
+ * its optional, but *not* in other cases, such as before the user has interacted with your app on the head unit.
+ * DISPLAY_MODE_ALWAYS - The lock screen should always be shown after connection.
+ */
+ @IntDef({DISPLAY_MODE_NEVER, DISPLAY_MODE_REQUIRED_ONLY, DISPLAY_MODE_OPTIONAL_OR_REQUIRED, DISPLAY_MODE_ALWAYS})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DisplayMode {}
+ public static final int DISPLAY_MODE_NEVER = 0;
+ public static final int DISPLAY_MODE_REQUIRED_ONLY = 1;
+ public static final int DISPLAY_MODE_OPTIONAL_OR_REQUIRED = 2;
+ public static final int DISPLAY_MODE_ALWAYS = 3;
public LockScreenConfig(){
// set default values
this.enable = true;
this.deviceLogo = true;
+ this.displayMode = DISPLAY_MODE_REQUIRED_ONLY;
+ this.enableDismissGesture = true;
}
/**
@@ -64,7 +92,10 @@ public class LockScreenConfig {
*
* If false, you must manage the lock screen
* @param enable boolean
+ *
+ * @deprecated to disable the lockscreen, use setDisplayMode with DISPLAY_MODE_NEVER instead
*/
+ @Deprecated
public void setEnabled(boolean enable){
this.enable = enable;
}
@@ -72,7 +103,10 @@ public class LockScreenConfig {
/**
* Gets whether the lock screen is being managed for you
* @return boolean
+ *
+ * @deprecated to disable the lockscreen, use setDisplayMode with DISPLAY_MODE_NEVER instead
*/
+ @Deprecated
public boolean isEnabled() {
return enable;
}
@@ -145,4 +179,39 @@ public class LockScreenConfig {
return deviceLogo;
}
+
+ /**
+ * Set the displayMode to be used
+ * @param displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.
+ */
+ public void setDisplayMode(@DisplayMode int displayMode){
+ this.displayMode = displayMode;
+ }
+
+ /**
+ * Get the displayMode to be used
+ * @return displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.
+ */
+ public @DisplayMode int getDisplayMode(){
+ return this.displayMode;
+ }
+
+ /**
+ * If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.
+ * @param enableDismissGesture - enable or disable this feature
+ */
+ public void enableDismissGesture(boolean enableDismissGesture) {
+ this.enableDismissGesture = enableDismissGesture;
+ }
+
+ /**
+ * If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.
+ * @return - whether or not this is enabled or disabled
+ */
+ public boolean enableDismissGesture() {
+ return enableDismissGesture;
+ }
+
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
index 43e40be6c..30ed1b575 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
@@ -32,8 +32,10 @@
package com.smartdevicelink.managers.lockscreen;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.Log;
@@ -49,6 +51,7 @@ import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.util.AndroidTools;
@@ -68,15 +71,17 @@ public class LockScreenManager extends BaseSubManager {
private static final String TAG = "LockScreenManager";
private WeakReference<Context> context;
- private HMILevel hmiLevel;
+ HMILevel hmiLevel;
private OnRPCNotificationListener systemRequestListener, ddListener, hmiListener;
private String deviceIconUrl;
- private boolean driverDistStatus;
+ boolean driverDistStatus, mIsLockscreenDismissible, enableDismissGesture, lockScreenEnabled, deviceLogoEnabled;
private volatile boolean isApplicationForegrounded;
private android.arch.lifecycle.LifecycleObserver lifecycleObserver;
- protected boolean lockScreenEnabled, deviceLogoEnabled;
- protected int lockScreenIcon, lockScreenColor, customView;
- protected Bitmap deviceLogo;
+ int lockScreenIcon, lockScreenColor, customView, displayMode;
+ Bitmap deviceLogo;
+ private boolean mLockScreenHasBeenDismissed, lockscreenDismissReceiverRegistered, receivedFirstDDNotification;
+ private String mLockscreenWarningMsg;
+ private BroadcastReceiver mLockscreenDismissedReceiver;
public LockScreenManager(LockScreenConfig lockScreenConfig, Context context, ISdl internalInterface){
@@ -93,6 +98,14 @@ public class LockScreenManager extends BaseSubManager {
customView = lockScreenConfig.getCustomView();
lockScreenEnabled = lockScreenConfig.isEnabled();
deviceLogoEnabled = lockScreenConfig.isDeviceLogoEnabled();
+ displayMode = lockScreenConfig.getDisplayMode();
+ enableDismissGesture = lockScreenConfig.enableDismissGesture();
+
+ // for older projects that may not use DisplayMode. This can
+ // be removed in a major release
+ if (!lockScreenEnabled){
+ displayMode = LockScreenConfig.DISPLAY_MODE_NEVER;
+ }
setupListeners();
}
@@ -108,6 +121,12 @@ public class LockScreenManager extends BaseSubManager {
// send broadcast to close lock screen if open
if (context.get() != null) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
+ try {
+ context.get().unregisterReceiver(mLockscreenDismissedReceiver);
+ lockscreenDismissReceiverRegistered = false;
+ } catch (IllegalArgumentException e) {
+ //do nothing
+ }
}
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -153,7 +172,11 @@ public class LockScreenManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
launchLockScreenActivity();
}
};
@@ -166,6 +189,22 @@ public class LockScreenManager extends BaseSubManager {
// do something with the status
if (notification != null) {
OnDriverDistraction ddState = (OnDriverDistraction) notification;
+ Boolean isDismissible = ddState.getLockscreenDismissibility();
+ Log.i(TAG, "Lock screen dismissible: "+ isDismissible);
+ if (isDismissible != null) {
+ // both of these conditions must be met to be able to dismiss lockscreen
+ if (isDismissible && enableDismissGesture){
+ mIsLockscreenDismissible = true;
+
+ // if DisplayMode is set to ALWAYS, it will be shown before the first DD notification.
+ // If this is our first DD notification and we are in ALWAYS mode, send another intent to
+ // enable the dismissal
+ if (!receivedFirstDDNotification && displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS ){
+ launchLockScreenActivity();
+ }
+ }
+ }
+ mLockscreenWarningMsg = ddState.getLockscreenWarningMessage();
if (ddState.getState() == DriverDistractionState.DD_ON){
// launch lock screen
@@ -174,10 +213,9 @@ public class LockScreenManager extends BaseSubManager {
}else{
// close lock screen
driverDistStatus = false;
- if (context.get() != null) {
- context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
- }
+ closeLockScreenActivity();
}
+ receivedFirstDDNotification = true;
}
}
};
@@ -226,6 +264,15 @@ public class LockScreenManager extends BaseSubManager {
} else{
isApplicationForegrounded = true;
}
+
+ mLockscreenDismissedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED.equals(intent.getAction())) {
+ mLockScreenHasBeenDismissed = true;
+ }
+ }
+ };
}
////
@@ -240,11 +287,20 @@ public class LockScreenManager extends BaseSubManager {
* X. If the status is set to OFF, Send broadcast to close lock screen if it is open
*/
private void launchLockScreenActivity(){
+ // If the user has dismissed the lockscreen for this run or has disabled it, do not show it
+ if (mLockScreenHasBeenDismissed || displayMode == LockScreenConfig.DISPLAY_MODE_NEVER) {
+ return;
+ }
// intent to open SDLLockScreenActivity
// pass in icon, background color, and custom view
if (lockScreenEnabled && isApplicationForegrounded && context.get() != null) {
+ if (mIsLockscreenDismissible && !lockscreenDismissReceiverRegistered) {
+ context.get().registerReceiver(mLockscreenDismissedReceiver, new IntentFilter(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED));
+ lockscreenDismissReceiverRegistered = true;
+
+ }
LockScreenStatus status = getLockScreenStatus();
- if (status == LockScreenStatus.REQUIRED) {
+ if (status == LockScreenStatus.REQUIRED || displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS || (status == LockScreenStatus.OPTIONAL && displayMode == LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED)) {
Intent showLockScreenIntent = new Intent(context.get(), SDLLockScreenActivity.class);
showLockScreenIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -254,8 +310,24 @@ public class LockScreenManager extends BaseSubManager {
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_CUSTOM_VIEW_EXTRA, customView);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_EXTRA, deviceLogoEnabled);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_BITMAP, deviceLogo);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSIBLE, mIsLockscreenDismissible);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_WARNING_MSG, mLockscreenWarningMsg);
context.get().startActivity(showLockScreenIntent);
} else if (status == LockScreenStatus.OFF) {
+ closeLockScreenActivity();
+ }
+ }
+ }
+
+ private void closeLockScreenActivity(){
+
+ if (displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS){
+ return;
+ }
+
+ if (context.get() != null) {
+ LockScreenStatus status = getLockScreenStatus();
+ if (status == LockScreenStatus.OFF || (status == LockScreenStatus.OPTIONAL && displayMode != LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED)) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
}
}
@@ -271,9 +343,9 @@ public class LockScreenManager extends BaseSubManager {
*
* @return Whether or not the Lock Screen is required
*/
- protected synchronized LockScreenStatus getLockScreenStatus() {
+ synchronized LockScreenStatus getLockScreenStatus() {
- if ( (hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
+ if ((hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
return LockScreenStatus.OFF;
}
else if ( hmiLevel.equals(HMILevel.HMI_BACKGROUND)) {
@@ -284,7 +356,7 @@ public class LockScreenManager extends BaseSubManager {
return LockScreenStatus.REQUIRED;
}
}
- else if ( (hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
+ else if ((hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
if (!driverDistStatus) {
return LockScreenStatus.OPTIONAL;
} else {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
index 6ae10ec73..d87d27ca2 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
@@ -39,9 +39,12 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
import android.view.Window;
import android.widget.ImageView;
import android.widget.RelativeLayout;
+import android.widget.TextView;
import com.smartdevicelink.R;
@@ -55,6 +58,12 @@ public class SDLLockScreenActivity extends Activity {
public static final String LOCKSCREEN_CUSTOM_VIEW_EXTRA = "LOCKSCREEN_CUSTOM_VIEW_EXTRA";
public static final String LOCKSCREEN_DEVICE_LOGO_DOWNLOADED = "LOCKSCREEN_DEVICE_LOGO_DOWNLOADED";
public static final String CLOSE_LOCK_SCREEN_ACTION = "CLOSE_LOCK_SCREEN";
+ public static final String KEY_LOCKSCREEN_DISMISSED = "KEY_LOCKSCREEN_DISMISSED";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "KEY_LOCKSCREEN_DISMISSIBLE";
+ public static final String KEY_LOCKSCREEN_WARNING_MSG = "KEY_LOCKSCREEN_WARNING_MSG";
+ private static final int MIN_SWIPE_DISTANCE = 200;
+ private boolean mIsDismissible;
+ private GestureDetector mGestureDetector;
private final BroadcastReceiver lockScreenBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -81,6 +90,7 @@ public class SDLLockScreenActivity extends Activity {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ mGestureDetector = new GestureDetector(this, new SwipeUpGestureListener());
// set any parameters that came from the lock screen manager
initializeActivity(getIntent());
@@ -94,6 +104,14 @@ public class SDLLockScreenActivity extends Activity {
}
@Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mIsDismissible) {
+ return mGestureDetector.onTouchEvent(event);
+ }
+ return super.onTouchEvent(event);
+ }
+
+ @Override
protected void onDestroy() {
unregisterReceiver(lockScreenBroadcastReceiver);
super.onDestroy();
@@ -107,6 +125,9 @@ public class SDLLockScreenActivity extends Activity {
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
+ if (intent != null && intent.getBooleanExtra(KEY_LOCKSCREEN_DISMISSIBLE, false)){
+ initializeActivity(intent);
+ }
}
public void initializeActivity(Intent intent){
@@ -133,6 +154,11 @@ public class SDLLockScreenActivity extends Activity {
if (deviceLogoEnabled && deviceIcon != null){
setDeviceLogo(deviceIcon);
}
+ mIsDismissible = intent.getBooleanExtra(KEY_LOCKSCREEN_DISMISSIBLE, false);
+ String warningMsg = intent.getStringExtra(KEY_LOCKSCREEN_WARNING_MSG);
+ if (mIsDismissible) {
+ setLockscreenWarningMessage(warningMsg);
+ }
}
}
}
@@ -154,8 +180,26 @@ public class SDLLockScreenActivity extends Activity {
}
}
+ private void setLockscreenWarningMessage(String msg) {
+ TextView tv = findViewById(R.id.lockscreen_text);
+ if (tv != null) {
+ tv.setText(msg != null ? msg : getString(R.string.default_lockscreen_warning_message));
+ }
+ }
+
private void setCustomView(int customView) {
setContentView(customView);
}
+ private class SwipeUpGestureListener extends GestureDetector.SimpleOnGestureListener {
+ @Override
+ public boolean onFling(MotionEvent event1, MotionEvent event2,
+ float velocityX, float velocityY) {
+ if ((event2.getY() - event1.getY()) > MIN_SWIPE_DISTANCE) {
+ sendBroadcast(new Intent(KEY_LOCKSCREEN_DISMISSED));
+ finish();
+ }
+ return true;
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
index 49798078c..73065b865 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
@@ -62,6 +62,7 @@ import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -92,6 +93,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
private VideoStreamingParameters parameters;
private IVideoStreamListener streamListener;
private boolean isTransportAvailable = false;
+ private boolean hasStarted;
// INTERNAL INTERFACES
@@ -114,8 +116,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
startEncoder();
stateMachine.transitionToState(StreamingStateMachine.STARTED);
-
-
+ hasStarted = true;
}
}
@@ -140,7 +141,11 @@ public class VideoStreamManager extends BaseVideoStreamManager {
@Override
public void onNotified(RPCNotification notification) {
if(notification != null){
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
if(hmiLevel.equals(HMILevel.HMI_FULL)){
checkState();
}
@@ -194,6 +199,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
&& hmiLevel != null
&& hmiLevel.equals(HMILevel.HMI_FULL)
&& parameters != null){
+ stateMachine.transitionToState(StreamingStateMachine.READY);
transitionToState(READY);
}
}
@@ -310,6 +316,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
//Encoder should be up and running
createRemoteDisplay(virtualDisplayEncoder.getVirtualDisplay());
stateMachine.transitionToState(StreamingStateMachine.STARTED);
+ hasStarted = true;
} catch (Exception e) {
stateMachine.transitionToState(StreamingStateMachine.ERROR);
e.printStackTrace();
@@ -384,8 +391,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
* @return boolean (true = yes, false = no)
*/
public boolean isStreaming(){
- return (stateMachine.getState() == StreamingStateMachine.STARTED) ||
- (hmiLevel == HMILevel.HMI_FULL);
+ return (stateMachine.getState() == StreamingStateMachine.STARTED) && (hmiLevel == HMILevel.HMI_FULL);
}
/**
@@ -393,8 +399,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
* @return boolean (true = not paused, false = paused)
*/
public boolean isPaused(){
- return (stateMachine.getState() == StreamingStateMachine.STARTED) ||
- (hmiLevel != HMILevel.HMI_FULL);
+ return (hasStarted && stateMachine.getState() == StreamingStateMachine.STOPPED) || (hmiLevel != HMILevel.HMI_FULL);
}
/**
@@ -451,9 +456,8 @@ public class VideoStreamManager extends BaseVideoStreamManager {
if(resolution != null){
DisplayMetrics displayMetrics = new DisplayMetrics();
disp.getMetrics(displayMetrics);
- touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
- touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
- }
+ createTouchScalar(resolution, displayMetrics);
+ }
}
@@ -499,6 +503,11 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
+ void createTouchScalar(ImageResolution resolution, DisplayMetrics displayMetrics) {
+ touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
+ touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
+ }
+
List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent){
List<MotionEvent> motionEventList = new ArrayList<MotionEvent>();
@@ -677,4 +686,4 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
index c06709b52..c443abfc6 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
@@ -36,7 +36,12 @@ import android.support.annotation.NonNull;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.TCPTransportManager;
import com.smartdevicelink.transport.TransportManager;
+import com.smartdevicelink.transport.enums.TransportType;
+
+import java.util.Collections;
@SuppressWarnings("WeakerAccess")
@@ -54,17 +59,26 @@ public class SdlProtocol extends SdlProtocolBase {
}
+ public SdlProtocol(@NonNull ISdlProtocol iSdlProtocol, @NonNull TCPTransportConfig config) {
+ super(iSdlProtocol,config);
+ this.requestedPrimaryTransports = Collections.singletonList(TransportType.TCP);
+ this.requestedSecondaryTransports = null;
+ this.requiresHighBandwidth =false;
+ this.setTransportManager(new TCPTransportManager(config,transportEventListener));
+ }
+
/**
* If there was a TransportListener attached to the supplied multiplex config, this method will
* call the onTransportEvent method.
*/
@Override
void notifyDevTransportListener (){
- MultiplexTransportConfig transportConfig = (MultiplexTransportConfig)this.transportConfig;
- if(transportConfig.getTransportListener() != null && transportManager != null) {
- transportConfig.getTransportListener().onTransportEvent(transportManager.getConnectedTransports(), isTransportForServiceAvailable(SessionType.PCM),isTransportForServiceAvailable(SessionType.NAV));
+ if(TransportType.MULTIPLEX.equals(transportConfig.getTransportType() )) {
+ MultiplexTransportConfig transportConfig = (MultiplexTransportConfig) this.transportConfig;
+ if (transportConfig.getTransportListener() != null && transportManager != null) {
+ transportConfig.getTransportListener().onTransportEvent(transportManager.getConnectedTransports(), isTransportForServiceAvailable(SessionType.PCM), isTransportForServiceAvailable(SessionType.NAV));
+ }
}
}
-
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
index 76f92487f..d94372740 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy;
import android.graphics.Bitmap;
@@ -40,6 +40,7 @@ import com.smartdevicelink.util.AndroidTools;
import java.io.IOException;
+@Deprecated
public class LockScreenManager {
public interface OnLockScreenIconDownloadedListener{
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
index a48376751..763c139e9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy;
import android.app.Service;
@@ -67,7 +67,13 @@ import java.util.Vector;
import static com.smartdevicelink.proxy.SystemCapabilityManager.convertToList;
-
+/**
+ * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
+ *
+ * The guide created for the initial transition of SdlProxyBase/ALM to SdlManager can be found at
+ * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
+ */
+@Deprecated
public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index b7d81716b..ec6c751b8 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -123,6 +123,7 @@ import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.SiphonServer;
+import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.CorrelationIdGenerator;
@@ -158,8 +159,14 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.ScheduledExecutorService;
-
+/**
+ * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
+ *
+ * The guide created for the initial transition of SdlProxyBase to SdlManager can be found at
+ * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
+ */
@SuppressWarnings({"WeakerAccess", "Convert2Diamond"})
+@Deprecated
public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> {
// Used for calls to Android Log class.
public static final String TAG = "SdlProxy";
@@ -246,6 +253,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private OnSystemRequest lockScreenIconRequest = null;
private TelephonyManager telephonyManager = null;
private DeviceInfo deviceInfo = null;
+ private ISdlServiceListener navServiceListener;
/**
* Contains current configuration for the transport that was selected during
@@ -342,6 +350,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if(isConnected()){
sdlSession.setDesiredVideoParams(parameters);
sdlSession.startService(SessionType.NAV,sdlSession.getSessionId(),encrypted);
+ addNavListener();
}
}
@@ -540,13 +549,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
+
notifyPutFileStreamError(null, info);
- if( altTransportAvailable){
+ if (altTransportAvailable){
SdlProxyBase.this._transportConfig = transportConfig;
Log.d(TAG, "notifying RPC session ended, but potential primary transport available");
cycleProxy(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
-
}else{
notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
}
@@ -1563,14 +1572,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
synchronized(CONNECTION_REFERENCE_LOCK) {
//Handle legacy USB connections
- if(_transportConfig != null
- && TransportType.USB.equals(_transportConfig.getTransportType())){
+ if (_transportConfig != null
+ && TransportType.USB.equals(_transportConfig.getTransportType())) {
//A USB transport config was provided
- USBTransportConfig usbTransportConfig = (USBTransportConfig)_transportConfig;
- if(usbTransportConfig.getUsbAccessory() == null){
+ USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
+ if (usbTransportConfig.getUsbAccessory() == null) {
DebugTool.logInfo("Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
//The accessory was null which means it came from a router service
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(),_appID);
+ MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), _appID);
multiplexTransportConfig.setRequiresHighBandwidth(true);
multiplexTransportConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
multiplexTransportConfig.setPrimaryTransports(Collections.singletonList(TransportType.USB));
@@ -1579,9 +1588,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- if(_transportConfig.getTransportType().equals(TransportType.MULTIPLEX)){
- this.sdlSession = new SdlSession2(_interfaceBroker,(MultiplexTransportConfig)_transportConfig);
- }else{
+ if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
+ this.sdlSession = new SdlSession2(_interfaceBroker, (MultiplexTransportConfig) _transportConfig);
+ }else if(_transportConfig != null &&_transportConfig.getTransportType().equals(TransportType.TCP)){
+ this.sdlSession = new SdlSession2(_interfaceBroker, (TCPTransportConfig) _transportConfig);
+ }else {
this.sdlSession = SdlSession.createSession((byte)getProtocolVersion().getMajor(),_interfaceBroker, _transportConfig);
}
}
@@ -1834,6 +1845,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
try{
_cycling = true;
cleanProxy(disconnectedReason);
+
initializeProxy();
if(!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)
&& !SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST.equals(disconnectedReason)){//We don't want to alert higher if we are just cycling for legacy bluetooth
@@ -3551,6 +3563,36 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onGetInteriorVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.CREATE_WINDOW.toString())) {
+ final CreateWindowResponse msg = new CreateWindowResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCreateWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCreateWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.DELETE_WINDOW.toString())) {
+ final DeleteWindowResponse msg = new DeleteWindowResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onDeleteWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onDeleteWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
// GetSystemCapabilityResponse
final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
@@ -3702,12 +3744,28 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onCloseApplicationResponse( msg);
+ _proxyListener.onCloseApplicationResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onCloseApplicationResponse( msg);
+ _proxyListener.onCloseApplicationResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.CANCEL_INTERACTION.toString())) {
+ final CancelInteractionResponse msg = new CancelInteractionResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCancelInteractionResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCancelInteractionResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNPUBLISH_APP_SERVICE.toString())) {
@@ -3726,6 +3784,52 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onUnpublishAppServiceResponse( msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.SHOW_APP_MENU.toString())) {
+ final ShowAppMenuResponse msg = new ShowAppMenuResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onShowAppMenuResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onShowAppMenuResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString())) {
+ final GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString())) {
+ final ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName +
@@ -3735,6 +3839,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} // end-if
+
} else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
// OnHMIStatus
@@ -4108,7 +4213,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_advancedLifecycleManagementEnabled) {
// This requires the proxy to be cycled
- cycleProxy(SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(msg.getReason()));
+
+ if(_mainUIHandler == null){
+ _mainUIHandler = new Handler(Looper.getMainLooper());
+ }
+
+ //This needs to be ran on the main thread
+
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ cycleProxy(SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(msg.getReason()));
+ }
+ });
} else {
if (_callbackToUIThread) {
// Run in UI thread
@@ -4813,7 +4930,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.setDesiredVideoParams(emptyParam);
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -4861,7 +4978,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.setDesiredVideoParams(emptyParam);
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -5235,7 +5352,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
navServiceStartRejectedParams = null;
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -5300,6 +5417,35 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.drainEncoder(endOfStream);
}
+ private void addNavListener(){
+
+ // videos may be started and stopped. Only add this once
+ if (navServiceListener == null){
+
+ navServiceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) { }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ // reset nav flags so nav can start upon the next transport connection
+ resetNavStartFlags();
+ // propagate notification up to proxy listener so the developer will know that the service is ended
+ if (_proxyListener != null) {
+ _proxyListener.onServiceEnded(new OnServiceEnded(type));
+ }
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ // if there is an error reset the flags so that there is a chance to restart streaming
+ resetNavStartFlags();
+ }
+ };
+ this.sdlSession.addServiceListener(SessionType.NAV, navServiceListener);
+ }
+ }
+
/**
* Opens a audio service (service type 10) and subsequently provides an IAudioStreamListener
* to the app to send audio data.
@@ -5452,7 +5598,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void AudioServiceEndedNACK() {
pcmServiceEndResponseReceived = true;
pcmServiceEndResponse = false;
- }
+ }
+
+ private void resetNavStartFlags() {
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
+ navServiceStartRejectedParams = null;
+ }
public void setAppService(Service mService)
{
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
index 897add3f5..5240c4813 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
@@ -49,6 +49,7 @@ import com.smartdevicelink.transport.MultiplexTransportConfig;
import java.util.List;
import java.util.Vector;
+@Deprecated
public class SdlProxyBuilder {
// Required parameters
private IProxyListenerALM listener;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
index c96df0f78..6e76db82a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
@@ -1,38 +1,39 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy;
import android.telephony.TelephonyManager;
+@Deprecated
public class SdlProxyConfigurationResources {
private String _sdlConfigurationFilePath;
private TelephonyManager _telephonyManager;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
index 8af6b1c59..a35b4790a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
@@ -173,7 +173,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
public void run() {
// Want to create presentation on UI thread so it finds the right Looper
// when setting up the Dialog.
- if ((remoteDisplay == null) && (mDisplay != null))
+ if((mDisplay!=null) && (remoteDisplay == null || remoteDisplay.getDisplay() != mDisplay))
{
try {
Constructor constructor = remoteDisplayClass.getConstructor(Context.class, Display.class);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
index d5843f4c2..63766f0b1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
@@ -47,6 +47,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import static com.smartdevicelink.util.DebugTool.logError;
import static com.smartdevicelink.util.NativeLogTool.logInfo;
@@ -354,8 +356,46 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
private class WriterThread extends Thread {
- private boolean mCancelled = false;
+ private boolean isHalted = false;
private boolean mVerbose = false;
+ final BlockingQueue<OutPacket> packetQueue = new LinkedBlockingQueue<>();
+
+ @Override
+ public void run() {
+ while(!isHalted){
+ try{
+ OutPacket packet = packetQueue.take();
+ if(packet == null){
+ continue;
+ }
+
+ OutputStream out;
+ synchronized (MultiplexTcpTransport.this) {
+ out = mOutputStream;
+ }
+
+ if ((out != null) && (!isHalted)) {
+ try {
+ out.write(packet.bytes, packet.offset, packet.count);
+ if (mVerbose) {
+ logInfo("TCPTransport.sendBytesOverTransport: successfully sent data");
+ }
+ } catch (IOException e) {
+ logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
+ }
+ } else {
+ if (isHalted) {
+ logError("TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
+ } else {
+ logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
+ }
+ }
+
+ }catch(InterruptedException e){
+ break;
+ }
+ }
+ }
public void write(byte[] msgBytes, int offset, int count) {
if ((msgBytes == null) || (msgBytes.length == 0)) {
@@ -366,32 +406,12 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
if (offset + count > msgBytes.length) {
count = msgBytes.length - offset;
}
+ packetQueue.add(new OutPacket(msgBytes, offset, count));
- OutputStream out;
- synchronized (MultiplexTcpTransport.this) {
- out = mOutputStream;
- }
-
- if ((out != null) && (!mCancelled)) {
- try {
- out.write(msgBytes, offset, count);
- if (mVerbose) {
- logInfo("TCPTransport.sendBytesOverTransport: successfully sent data");
- }
- } catch (IOException e) {
- logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
- }
- } else {
- if (mCancelled) {
- logError("TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
- } else {
- logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
- }
- }
}
public synchronized void cancel() {
- mCancelled = true;
+ isHalted = true;
if (mOutputStream != null) {
synchronized (MultiplexTcpTransport.this) {
try {
@@ -410,4 +430,18 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
}
}
+
+ private final class OutPacket{
+ byte[] bytes;
+ int count;
+ int offset;
+
+ OutPacket(byte[] bytes, int offset, int count){
+ this.bytes = bytes;
+ this.offset = offset;
+ this.count = count;
+ }
+ }
+
+
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index dcfee9745..60ff45206 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -3173,10 +3173,10 @@ public class SdlRouterService extends Service{
* @return
*/
private TransportType getCompatPrimaryTransport(){
- if(this.registeredTransports != null){
+ if(this.registeredTransports != null && this.registeredTransports.size() > 0) {
List<TransportType> transportTypes = this.registeredTransports.valueAt(0);
- if(transportTypes != null){
- if(transportTypes.get(0) != null){
+ if (transportTypes != null) {
+ if (transportTypes.get(0) != null) {
return transportTypes.get(0);
}
}
@@ -3199,7 +3199,9 @@ public class SdlRouterService extends Service{
int flags = receivedBundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
TransportType transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
if(transportType == null){
- transportType = getCompatPrimaryTransport();
+ synchronized (TRANSPORT_LOCK){
+ transportType = getCompatPrimaryTransport();
+ }
receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
new file mode 100644
index 000000000..29e0c3aa1
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
@@ -0,0 +1,135 @@
+package com.smartdevicelink.transport;
+
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+import com.smartdevicelink.protocol.SdlPacket;
+import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+
+public class TCPTransportManager extends TransportManagerBase{
+
+ private static final String TAG = "TCPTransportManager";
+
+ private TCPHandler tcpHandler;
+ private MultiplexTcpTransport transport;
+ private TCPTransportConfig config;
+
+ public TCPTransportManager(TCPTransportConfig config, TransportEventListener transportEventListener){
+ super(config,transportEventListener);
+ Log.d(TAG, "USING THE TCP TRANSPORT MANAGER");
+ this.config = config;
+ tcpHandler = new TCPHandler(this);
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(),tcpHandler, null);
+ }
+
+ @Override
+ public void start() {
+ transport.start();
+
+ }
+
+ @Override
+ public void close(long sessionId) {
+ transport.stop();
+ }
+
+ @Override
+ public void resetSession() {
+ if(transport != null){
+ transport.stop();
+ }
+ //TODO make sure this makes sense
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(), tcpHandler, null);
+
+ }
+
+ @Override
+ public boolean isConnected(TransportType transportType, String address) {
+ return (transportType == null || TransportType.TCP.equals(transportType)) && transport.isConnected();
+ }
+
+ @Override
+ public TransportRecord getTransportRecord(TransportType transportType, String address) {
+ if(transport != null){
+ return transport.getTransportRecord();
+ }else{
+ return null;
+ }
+ }
+
+ @Override
+ public void sendPacket(SdlPacket packet) {
+ if(packet != null){
+ byte[] rawBytes = packet.constructPacket();
+ if(rawBytes != null && rawBytes.length >0){
+ transport.write(rawBytes, 0, rawBytes.length);
+ }
+ }
+
+ }
+
+
+ protected static class TCPHandler extends Handler {
+
+ final WeakReference<TCPTransportManager> provider;
+
+ public TCPHandler(TCPTransportManager provider){
+ this.provider = new WeakReference<>(provider);
+ }
+ @Override
+ public void handleMessage(Message msg) {
+ if(this.provider.get() == null){
+ return;
+ }
+ TCPTransportManager service = this.provider.get();
+ if(service.transportListener == null){
+ return;
+ }
+ switch (msg.what) {
+ case SdlRouterService.MESSAGE_STATE_CHANGE:
+ switch (msg.arg1) {
+ case MultiplexBaseTransport.STATE_CONNECTED:
+ synchronized (service.TRANSPORT_STATUS_LOCK){
+ service.transportStatus.clear();
+ service.transportStatus.add(service.transport.getTransportRecord());
+ }
+ DebugTool.logInfo("TCP transport has connected");
+ service.transportListener.onTransportConnected(service.transportStatus);
+ break;
+ case MultiplexBaseTransport.STATE_CONNECTING:
+ // Currently attempting to connect - update UI?
+ break;
+ case MultiplexBaseTransport.STATE_LISTEN:
+ if(service.transport != null){
+ service.transport.stop();
+ service.transport = null;
+ }
+ break;
+ case MultiplexBaseTransport.STATE_NONE:
+ // We've just lost the connection
+ if(service.transport != null){
+ service.transportListener.onTransportDisconnected("TCP transport disconnected", service.transport.transportRecord, null);
+ }else{
+ service.transportListener.onTransportDisconnected("TCP transport disconnected", null, null);
+
+ }
+ break;
+ case MultiplexBaseTransport.STATE_ERROR:
+ Log.d(TAG, "TCP transport encountered an error");
+ service.transportListener.onError("TCP transport encountered an error" );
+ break;
+ }
+ break;
+
+ case SdlRouterService.MESSAGE_READ:
+ service.transportListener.onPacketReceived((SdlPacket) msg.obj);
+ break;
+ }
+ }
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
index 0ab335bf9..10cb518d4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
@@ -55,6 +55,7 @@ import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.ByteAraryMessageAssembler;
import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
@@ -119,7 +120,6 @@ public class TransportBroker {
Log.d(TAG, "Unbound from service " + className.getClassName());
routerServiceMessenger = null;
registeredWithRouterService = false;
- unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
}
@@ -158,6 +158,7 @@ public class TransportBroker {
Log.d(TAG, "Dead object while attempting to send packet");
routerServiceMessenger = null;
registeredWithRouterService = false;
+ unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
return false;
@@ -166,6 +167,7 @@ public class TransportBroker {
Log.d(TAG, "Null messenger while attempting to send packet"); // NPE, routerServiceMessenger is null
routerServiceMessenger = null;
registeredWithRouterService = false;
+ unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
return false;
@@ -448,7 +450,7 @@ public class TransportBroker {
* This method will end our communication with the router service.
*/
public void stop() {
- //Log.d(TAG, "STOPPING transport broker for " + whereToReply);
+ DebugTool.logInfo("Stopping transport broker for " + whereToReply);
synchronized (INIT_LOCK) {
unregisterWithRouterService();
unBindFromRouterService();
@@ -461,15 +463,13 @@ public class TransportBroker {
private synchronized void unBindFromRouterService() {
try {
- if (isBound && getContext() != null && routerConnection != null) {
- getContext().unbindService(routerConnection);
- isBound = false;
- } else {
- Log.w(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
- }
+ getContext().unbindService(routerConnection);
- } catch (IllegalArgumentException e) {
+ } catch (Exception e) {
//This is ok
+ Log.w(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
+ }finally {
+ isBound = false;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
index 6e7fd7c75..d33f4c374 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
@@ -72,6 +72,10 @@ public class WiFiSocketFactory {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Socket createWiFiSocket(Context context) {
+ if(context == null){
+ logInfo("Context supplied was null");
+ return null;
+ }
PackageManager pm = context.getPackageManager();
if (pm == null) {
logInfo("PackageManager isn't available.");
diff --git a/android/sdl_android/src/main/res/values/strings.xml b/android/sdl_android/src/main/res/values/strings.xml
index 1d55ec24d..f74ce713b 100644
--- a/android/sdl_android/src/main/res/values/strings.xml
+++ b/android/sdl_android/src/main/res/values/strings.xml
@@ -3,4 +3,5 @@
<string name="lockscreen_text">Locked for your safety</string>
<string name="lockscreen_image_description">SDL Icon</string>
<string name="lockscreen_device_image_description">Device Icon</string>
+ <string name="default_lockscreen_warning_message">Swipe down to dismiss, acknowledging that you are not the driver.</string>
</resources> \ No newline at end of file
diff --git a/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java b/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
index 3658db561..0bf6dc34f 100644
--- a/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
+++ b/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
@@ -28,6 +28,8 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import junit.framework.TestCase;
@@ -46,6 +48,7 @@ import java.util.ArrayList;
import java.util.List;
import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -93,7 +96,7 @@ public class HapticInterfaceManagerTest extends TestCase {
public void testRefreshHapticData() throws Exception {
View root = createViews();
hapticMgr.refreshHapticData(root);
- verify(mockProxy).sendRPCRequest(captor.capture());
+ verify(mockProxy).sendRPC(captor.capture());
SendHapticData data = captor.getValue();
assertNotNull("SendHapticData RPC", data);
List<HapticRect> list = data.getHapticRectData();
@@ -104,7 +107,7 @@ public class HapticInterfaceManagerTest extends TestCase {
@Test
public void testRefreshHapticDataNull() throws Exception {
hapticMgr.refreshHapticData(null);
- verify(mockProxy).sendRPCRequest(captor.capture());
+ verify(mockProxy).sendRPC(captor.capture());
SendHapticData data = captor.getValue();
assertNotNull("SendHapticData RPC", data);
List<HapticRect> list = data.getHapticRectData();
@@ -112,6 +115,86 @@ public class HapticInterfaceManagerTest extends TestCase {
}
@Test
+ public void testRefreshHapticData_Scale_2_0() {
+ double scale = 2.0;
+
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(120.0f);
+ expected.setY(120.0f);
+ expected.setWidth(300.0f);
+ expected.setHeight(140.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(scale);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+
+ @Test
+ public void testRefreshHapticData_Scale_0_5() {
+ double scale = 0.5;
+
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(30.0f);
+ expected.setY(30.0f);
+ expected.setWidth(75.0f);
+ expected.setHeight(35.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(scale);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+
+
+ @Test
+ public void testRefreshHapticData_NullCapability() {
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(60.0f);
+ expected.setY(60.0f);
+ expected.setWidth(150.0f);
+ expected.setHeight(70.0f);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, null);
+ }
+
+ @Test
+ public void testRefreshHapticData_NullScale() {
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(60.0f);
+ expected.setY(60.0f);
+ expected.setWidth(150.0f);
+ expected.setHeight(70.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(null);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+ @Test
public void testRefreshWithUserData() throws Exception {
List<HapticRect> rects = new ArrayList<>();
Rectangle rect = new Rectangle();
@@ -170,4 +253,43 @@ public class HapticInterfaceManagerTest extends TestCase {
return parent1;
}
+
+
+ private View createView(final int x, final int y, int w, int h) {
+ View button = mock(View.class);
+ when(button.isFocusable()).thenReturn(true);
+ doAnswer(new Answer() {
+ @Override
+ public int[] answer(InvocationOnMock invocation) throws Throwable {
+ int[] args = (int[])(invocation.getArguments()[0]);
+ args[0] = x;
+ args[1] = y;
+ return args;
+ }
+ }).when(button).getLocationOnScreen(any(int[].class));
+
+ when(button.getWidth()).thenReturn(w);
+ when(button.getHeight()).thenReturn(h);
+ return button;
+ }
+
+ private void assertViewWithCapability(int x, int y, int w, int h, Rectangle expected, VideoStreamingCapability capability) {
+ when(mockProxy.getCapability(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(capability);
+
+ View button = createView(x, y, w, h);
+
+
+ hapticMgr.refreshHapticData(button);
+ verify(mockProxy).sendRPC(captor.capture());
+
+ SendHapticData data = captor.getValue();
+ List<HapticRect> list = data.getHapticRectData();
+ assertEquals(1, list.size());
+ Rectangle current = list.get(0).getRect();
+
+ assertEquals(expected.getX(), current.getX(), 0.0005);
+ assertEquals(expected.getY(), current.getY(), 0.0005);
+ assertEquals(expected.getWidth(), current.getWidth(), 0.0005);
+ assertEquals(expected.getHeight(), current.getHeight(), 0.0005);
+ }
}
diff --git a/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java b/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java
new file mode 100644
index 000000000..9088e716d
--- /dev/null
+++ b/android/sdl_android/src/test/java/com/smartdevicelink/streaming/video/VideoStreamingParametersTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
+package com.smartdevicelink.streaming.video;
+
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class VideoStreamingParametersTest {
+ private VideoStreamingParameters params;
+ private VideoStreamingCapability capability;
+ private ImageResolution preferredResolution;
+
+ @Before
+ public void setUp() {
+ params = new VideoStreamingParameters();
+ capability = new VideoStreamingCapability();
+ }
+
+ @Test
+ public void update_NullScale() {
+ preferredResolution = new ImageResolution(800, 354);
+
+ capability.setScale(null);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(800, width);
+ assertEquals(354, height);
+ }
+
+ @Test
+ public void update_Scale_1_Resolution_800_354() {
+ preferredResolution = new ImageResolution(800, 354);
+
+ capability.setScale(1.0);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(800, width);
+ assertEquals(354, height);
+ }
+
+ @Test
+ public void update_Scale_1_25_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.25);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(1024, width);
+ assertEquals(456, height);
+ }
+
+ @Test
+ public void update_Scale_1_5_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.5);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(854, width);
+ assertEquals(380, height);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
index 5f73be39d..73a9c3dfd 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
@@ -63,6 +63,8 @@ abstract class BaseSdlManager {
final Object STATE_LOCK = new Object();
int state = -1;
+ static final int MAX_RETRY = 3;
+ int changeRegistrationRetry = 0;
String appId, appName, shortAppName;
boolean isMediaApp;
Language hmiLanguage;
@@ -179,6 +181,7 @@ abstract class BaseSdlManager {
abstract void checkState();
protected abstract void initialize();
+ protected abstract void checkLifecycleConfiguration();
//Public abstract API
public abstract void start();
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
new file mode 100644
index 000000000..031918d3b
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 8/1/19 3:11 PM
+ *
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.support.annotation.Nullable;
+
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+
+import java.util.Vector;
+
+/**
+ * Configuration update options for SDLManager. This class can be used to update the lifecycle configuration in
+ * cases the language of the head unit changes or does not match the app language.
+ */
+public class LifecycleConfigurationUpdate {
+
+ private String appName, shortAppName;
+ private Vector<TTSChunk> ttsName;
+ private Vector<String> voiceRecognitionCommandNames;
+
+ // default constructor
+ public LifecycleConfigurationUpdate(){}
+
+ /**
+ * Initializes and returns a newly allocated lifecycle configuration update object with the specified app data.
+ * @param appName The full name of the app to that the configuration should be updated to.
+ * @param shortAppName An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ * @param ttsName A Text to Speech String for voice recognition of the mobile application name.
+ * @param voiceRecognitionCommandNames Additional voice recognition commands. May not interfere with any other app name or global commands.
+ */
+ public LifecycleConfigurationUpdate(@Nullable String appName, @Nullable String shortAppName, @Nullable Vector<TTSChunk> ttsName, @Nullable Vector<String> voiceRecognitionCommandNames){
+ setAppName(appName);
+ setShortAppName(shortAppName);
+ setTtsName(ttsName);
+ setVoiceRecognitionCommandNames(voiceRecognitionCommandNames);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * The full name of the app to that the configuration should be updated to.
+ */
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ /**
+ * The full name of the app to that the configuration should be updated to.
+ */
+ public String getAppName() {
+ return appName;
+ }
+
+ /**
+ * An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ */
+ public void setShortAppName(String shortAppName) {
+ this.shortAppName = shortAppName;
+ }
+
+ /**
+ * An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ */
+ public String getShortAppName() {
+ return shortAppName;
+ }
+
+ /**
+ * A Text to Speech String for voice recognition of the mobile application name.
+ */
+ public void setTtsName(Vector<TTSChunk> ttsName) {
+ this.ttsName = ttsName;
+ }
+
+ /**
+ * A Text to Speech String for voice recognition of the mobile application name.
+ */
+ public Vector<TTSChunk> getTtsName() {
+ return ttsName;
+ }
+
+ public void setVoiceRecognitionCommandNames(Vector<String> voiceRecognitionCommandNames) {
+ this.voiceRecognitionCommandNames = voiceRecognitionCommandNames;
+ }
+
+ /**
+ * Additional voice recognition commands. May not interfere with any other app name or global commands.
+ */
+ public Vector<String> getVoiceRecognitionCommandNames() {
+ return voiceRecognitionCommandNames;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
index 6b9e198c2..3e1ee1486 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
@@ -43,6 +43,7 @@ import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import java.lang.annotation.Retention;
@@ -97,8 +98,12 @@ abstract class BasePermissionManager extends BaseSubManager{
onHMIStatusListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel previousHMILevel = currentHMILevel;
- currentHMILevel = ((OnHMIStatus)notification).getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
checkState();
notifyListeners(currentPermissionItems, previousHMILevel, currentPermissionItems, currentHMILevel);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index dff87b5b0..0a9404c4c 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -410,6 +410,8 @@ abstract class BaseScreenManager extends BaseSubManager {
this.voiceCommandManager.setVoiceCommands(voiceCommands);
}
+ // MENUS
+
/**
* The list of currently set menu cells
* @return a List of the currently set menu cells
@@ -436,7 +438,6 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
- *
* @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE if not set.
*/
public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode(){
@@ -444,7 +445,26 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
- * The main menu layout. See available menu layouts on DisplayCapabilities.menuLayoutsAvailable. Defaults to LIST.
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens the Main Menu.
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openMenu(){
+ return this.menuManager.openMenu();
+ }
+
+ /**
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+ return this.menuManager.openSubMenu(cell);
+ }
+
+ /**
+ * The main menu layout. See available menu layouts on DisplayCapabilities.menuLayoutsAvailable.
* @param menuConfiguration - The default menuConfiguration
*/
public void setMenuConfiguration(@NonNull MenuConfiguration menuConfiguration) {
@@ -452,7 +472,7 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
- * The main menu layout. See available menu layouts on DisplayCapabilities.menuLayoutsAvailable. Defaults to LIST.
+ * The main menu layout. See available menu layouts on DisplayCapabilities.menuLayoutsAvailable.
* @return the currently set MenuConfiguration
*/
public MenuConfiguration getMenuConfiguration(){
@@ -502,9 +522,10 @@ abstract class BaseScreenManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardProperties - the custom keyboard configuration to be used when the keyboard is displayed
* @param keyboardListener - A keyboard listener to capture user input
+ * @return A unique cancelID that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
- this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
+ return this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
}
/**
@@ -522,6 +543,14 @@ abstract class BaseScreenManager extends BaseSubManager {
return this.choiceSetManager.getPreloadedChoices();
}
+ /**
+ * Dismisses a currently presented keyboard with the associated ID. Canceling a keyboard only works when connected to SDL Core v.6.0+. When connected to older versions of SDL Core the keyboard will not be dismissed.
+ * @param cancelID The unique ID assigned to the keyboard
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ this.choiceSetManager.dismissKeyboard(cancelID);
+ }
+
// END CHOICE SETS
/**
@@ -561,5 +590,4 @@ abstract class BaseScreenManager extends BaseSubManager {
}
});
}
-
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
index ae3d9b7cd..54a851684 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
@@ -53,6 +53,7 @@ import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
@@ -153,8 +154,10 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
this.onHMIStatusListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
-
- OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHmiLevel = currentHMILevel;
currentHMILevel = onHMIStatus.getHmiLevel();
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
index d4ca4321e..653c3564c 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -51,6 +51,7 @@ import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
@@ -156,7 +157,11 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- currentHMILevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_FULL){
if (pendingHMIFull){
DebugTool.logInfo( "Acquired HMI_FULL with pending update. Sending now");
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
new file mode 100644
index 000000000..c0a1dbb25
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/25/19 8:43 AM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+import com.smartdevicelink.util.DebugTool;
+
+class AsynchronousOperation implements Runnable {
+ private static final String TAG = "AsynchronousOperation - ";
+ private Thread thread;
+ private final Object lock;
+ private boolean blocked;
+ private boolean executing;
+ private boolean finished;
+ private boolean cancelled;
+
+ AsynchronousOperation() {
+ lock = new Object();
+ blocked = false;
+ executing = false;
+ finished = false;
+ cancelled = false;
+ }
+
+ @Override
+ public void run() {
+ thread = Thread.currentThread();
+ DebugTool.logInfo(TAG + "Starting: " + toString());
+ if (isCancelled()) {
+ finished = true;
+ DebugTool.logInfo(TAG + "Operation was cancelled: " + toString());
+ return;
+ }
+
+ executing = true;
+ }
+
+ void finishOperation() {
+ unblock();
+ executing = false;
+ finished = true;
+ cancelled = false;
+ DebugTool.logInfo(TAG + "Finishing: " + toString());
+ }
+
+ boolean isExecuting() {
+ return executing;
+ }
+
+ boolean isFinished() {
+ return finished;
+ }
+
+ void cancel(){
+ cancelled = true;
+ }
+
+ boolean isCancelled() {
+ return cancelled;
+ }
+
+ void block(){
+ if (!blocked && !finished) {
+ blocked = true;
+ DebugTool.logInfo(TAG + "Blocking: " + toString());
+ try {
+ synchronized (lock) {
+ lock.wait();
+ }
+ } catch (InterruptedException e) {
+ DebugTool.logWarning(TAG + "InterruptedException: " + toString());
+ finishOperation();
+ }
+ }
+ }
+
+ void unblock(){
+ if (blocked) {
+ blocked = false;
+ DebugTool.logInfo(TAG + "Unblocking: " + toString());
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + " (OpId: " + System.identityHashCode(this) + ", OpThread:" + (thread != null ? thread.getName() : "no operating thread") + ", currentThread:" + Thread.currentThread().getName() + ", blocked:" + blocked + ", executing:" + executing + ", finished:" + finished + ", cancelled:" + cancelled + ")";
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
index 9770898bc..e343cd131 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
@@ -52,6 +52,7 @@ import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
@@ -85,16 +86,18 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
SystemContext currentSystemContext;
HashSet<ChoiceCell> preloadedChoices, pendingPreloadChoices;
ChoiceSet pendingPresentationSet;
- private List<ChoiceCell> waitingChoices;
- private CompletionListener waitingListener;
// We will pass operations into this to be completed
PausableThreadPoolExecutor executor;
LinkedBlockingQueue<Runnable> operationQueue;
Future pendingPresentOperation;
+ PresentKeyboardOperation currentlyPresentedKeyboardOperation;
+
int nextChoiceId;
+ int nextCancelId;
final int choiceCellIdMin = 1;
+ final int choiceCellCancelIdMin = 1;
boolean isVROptional;
BaseChoiceSetManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
@@ -110,11 +113,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
preloadedChoices = new HashSet<>();
pendingPreloadChoices = new HashSet<>();
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
isVROptional = false;
keyboardConfiguration = defaultKeyboardConfiguration();
operationQueue = new LinkedBlockingQueue<>();
executor = new PausableThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors(), 10, TimeUnit.SECONDS, operationQueue);
executor.pause(); // pause until HMI ready
+
+ currentlyPresentedKeyboardOperation = null;
}
@Override
@@ -137,10 +143,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
pendingPresentationSet = null;
pendingPresentOperation = null;
- waitingChoices = null;
- waitingListener = null;
- isVROptional = true;
+ isVROptional = false;
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -161,7 +166,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onError(String error) {
- // At this point, there were errors trying to send a test CICS
+ // At this point, there were errors trying to send a test PICS
// If we reach this state, we cannot use the manager
DebugTool.logError(error);
transitionToState(ERROR);
@@ -181,10 +186,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){
- if (!isReady()){
- waitingChoices = new ArrayList<>(choices);
- waitingListener = listener;
- DebugTool.logInfo("Preload pending choice set manager being ready");
+ if (getState() == ERROR){
return;
}
@@ -214,15 +216,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (listener != null){
listener.onComplete(true);
}
- waitingChoices = null;
- waitingListener = null;
}else {
DebugTool.logError("There was an error pre loading choice cells");
- if (listener != null){
+ if (listener != null) {
listener.onComplete(false);
}
- waitingChoices = null;
- waitingListener = null;
}
}
});
@@ -239,7 +237,10 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void deleteChoices(@NonNull List<ChoiceCell> choices){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Find cells to be deleted that are already uploaded or are pending upload
final HashSet<ChoiceCell> cellsToBeDeleted = choicesToBeDeletedWithArray(choices);
@@ -251,7 +252,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
if (pendingPresentOperation != null && !pendingPresentOperation.isCancelled() && !pendingPresentOperation.isDone() && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
pendingPresentOperation = null;
}
@@ -291,13 +292,16 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Perform additional checks against the ChoiceSet
if (!setUpChoiceSet(choiceSet)){ return; }
if (this.pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Presenting a choice set while one is currently presented. Cancelling previous and continuing");
}
@@ -321,6 +325,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
findIdsOnChoiceSet(pendingPresentationSet);
+
// Pass back the information to the developer
ChoiceSetSelectionListener privateChoiceListener = new ChoiceSetSelectionListener() {
@Override
@@ -328,8 +333,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onChoiceSelected(choiceCell, triggerSource,rowIndex);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
@Override
@@ -337,8 +340,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onError(error);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
};
@@ -347,11 +348,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (keyboardListener == null){
// Non-searchable choice set
DebugTool.logInfo("Creating non-searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener, nextCancelId++);
} else {
// Searchable choice set
DebugTool.logInfo("Creating searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener, nextCancelId++);
}
pendingPresentOperation = executor.submit(presentOp);
@@ -362,18 +363,21 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardConfig - the custom keyboard configuration to be used when the keyboard is displayed
* @param listener - A keyboard listener to capture user input
+ * @return - A unique id that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
-
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
if (initialText == null || initialText.length() == 0){
DebugTool.logError("initialText cannot be an empty string.");
- return;
+ return null;
}
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return null;
+ }
if (pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
pendingPresentationSet = null;
DebugTool.logWarning("There is a current or pending choice set, cancelling and continuing.");
}
@@ -388,8 +392,42 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Present a keyboard with the choice set that we used to test VR's optional state
DebugTool.logInfo("Presenting Keyboard - Choice Set Manager");
- PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener);
+ Integer keyboardCancelID = nextCancelId++;
+ PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener, keyboardCancelID);
+ currentlyPresentedKeyboardOperation = keyboardOp;
pendingPresentOperation = executor.submit(keyboardOp);
+ return keyboardCancelID;
+ }
+
+ /**
+ * 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.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ *
+ * @param cancelID - The unique ID assigned to the keyboard, passed as the return value from `presentKeyboard`
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
+
+ // First, attempt to cancel the currently executing keyboard operation (Once an operation has started it is removed from the operationQueue)
+ if (currentlyPresentedKeyboardOperation != null && currentlyPresentedKeyboardOperation.getCancelID().equals(cancelID)) {
+ currentlyPresentedKeyboardOperation.dismissKeyboard();
+ return;
+ }
+
+ // Next, attempt to cancel keyboard operations that have not yet started
+ for (Runnable operation : operationQueue){
+ if (!(operation instanceof PresentKeyboardOperation)){ continue; }
+
+ PresentKeyboardOperation pendingOp = (PresentKeyboardOperation) operation;
+ if (!(pendingOp.getCancelID().equals(cancelID))) { continue; }
+
+ pendingOp.dismissKeyboard();
+ break;
+ }
}
/**
@@ -489,9 +527,12 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus hmiStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = hmiStatus.getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_NONE){
executor.pause();
@@ -499,13 +540,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
- currentSystemContext = hmiStatus.getSystemContext();
+ currentSystemContext = onHMIStatus.getSystemContext();
if (currentSystemContext == SystemContext.SYSCTXT_HMI_OBSCURED || currentSystemContext == SystemContext.SYSCTXT_ALERT){
executor.pause();
@@ -513,10 +550,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
}
@@ -586,13 +619,4 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
defaultProperties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
return defaultProperties;
}
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- private boolean isReady(){
- if (getState() != READY){
- DebugTool.logWarning("Choice Manager In Not-Ready State");
- return false;
- }
- return true;
- }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
index 074f89947..1c427c16b 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
@@ -47,21 +47,24 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.Collections;
-class CheckChoiceVROptionalOperation implements Runnable {
+class CheckChoiceVROptionalOperation extends AsynchronousOperation {
private CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
private WeakReference<ISdl> internalInterface;
private boolean isVROptional;
CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
}
@Override
public void run() {
+ CheckChoiceVROptionalOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing check vr optional operation");
sendTestChoiceNoVR();
+ block();
}
/**
@@ -80,17 +83,15 @@ class CheckChoiceVROptionalOperation implements Runnable {
isVROptional = true;
deleteTestChoiceSet();
}else{
+ DebugTool.logWarning("Head unit doesn't support choices with no VR.");
sendTestChoiceWithVR();
}
}
@Override
public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("There was an error in the check choice vr optional operation. Send test choice with no VR failed. Error: " + info + " resultCode: " + resultCode);
- isVROptional = false;
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onError(info);
- }
+ DebugTool.logWarning("Head unit doesn't support choices with no VR. Error: " + info + " resultCode: " + resultCode);
+ sendTestChoiceWithVR();
}
});
@@ -119,6 +120,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(response.getInfo());
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
}
@@ -129,6 +132,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
@@ -149,6 +154,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
@Override
@@ -157,6 +164,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
if (internalInterface.get() != null){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
index 7a1c0b138..b846760c7 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
@@ -53,6 +53,7 @@ public class ChoiceSet {
private List<VrHelpItem> vrHelpList;
private ChoiceSetSelectionListener choiceSetSelectionListener;
private KeyboardProperties customKeyboardConfiguration;
+ ChoiceSetCanceledListener canceledListener;
// defaults
private Integer defaultTimeout = 10;
@@ -153,6 +154,16 @@ public class ChoiceSet {
}
/**
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be immediately dismissed. Canceling an already presented choice set will only work if connected to Core versions 6.0+. On older versions of Core, the choice set will not be dismissed.
+ */
+ public void cancel() {
+ if (canceledListener == null) {
+ return;
+ }
+ canceledListener.onChoiceSetCanceled();
+ }
+
+ /**
* Maps to PerformInteraction.initialText. The title of the choice set, and/or the initial text on a keyboard prompt.
* @return the title
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
new file mode 100644
index 000000000..89e850b1e
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 2:08 PM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+interface ChoiceSetCanceledListener {
+ /**
+ * Notifies the subscriber that the choice set should be cancelled.
+ */
+ void onChoiceSetCanceled();
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
index fdb01ae38..2fc6c314d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
@@ -48,13 +48,14 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-class DeleteChoicesOperation implements Runnable {
+class DeleteChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private HashSet<ChoiceCell> cellsToDelete;
private CompletionListener completionListener;
DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.cellsToDelete = cellsToDelete;
this.completionListener = completionListener;
@@ -62,8 +63,10 @@ class DeleteChoicesOperation implements Runnable {
@Override
public void run() {
+ DeleteChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing delete choices operation");
sendDeletions();
+ block();
}
private void sendDeletions(){
@@ -84,6 +87,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(true);
}
DebugTool.logInfo("Successfully deleted choices");
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
@@ -92,6 +97,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(false);
}
DebugTool.logError("Failed to delete choice: " + info + " | Corr ID: " + correlationId);
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
index f3d708998..99cd91a96 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
@@ -62,7 +62,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
-class PreloadChoicesOperation implements Runnable {
+class PreloadChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private WeakReference<FileManager> fileManager;
@@ -74,6 +74,7 @@ class PreloadChoicesOperation implements Runnable {
PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, DisplayCapabilities displayCapabilities,
Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.fileManager = new WeakReference<>(fileManager);
this.displayCapabilities = displayCapabilities;
@@ -84,6 +85,7 @@ class PreloadChoicesOperation implements Runnable {
@Override
public void run() {
+ PreloadChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing preload choices operation");
preloadCellArtworks(new CompletionListener() {
@Override
@@ -91,6 +93,7 @@ class PreloadChoicesOperation implements Runnable {
preloadCells();
}
});
+ block();
}
void removeChoicesFromUpload(HashSet<ChoiceCell> choices){
@@ -161,11 +164,15 @@ class PreloadChoicesOperation implements Runnable {
isRunning = false;
DebugTool.logInfo("Finished pre loading choice cells");
completionListener.onComplete(true);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
DebugTool.logError("There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
index e170dd89e..af69c0926 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
@@ -40,10 +40,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -58,10 +60,11 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-class PresentChoiceSetOperation implements Runnable {
+class PresentChoiceSetOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private ChoiceSet choiceSet;
+ private Integer cancelID;
private InteractionMode presentationMode;
private KeyboardProperties originalKeyboardProperties, keyboardProperties;
private ChoiceCell selectedCell;
@@ -71,27 +74,44 @@ class PresentChoiceSetOperation implements Runnable {
private ChoiceSetSelectionListener choiceSetSelectionListener;
Integer selectedCellRow;
KeyboardListener keyboardListener;
+ SdlMsgVersion sdlMsgVersion;
PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
- KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener){
+ KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.choiceSet = choiceSet;
+ this.choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ cancelInteraction();
+ }
+ };
this.presentationMode = mode;
+ this.cancelID = cancelID;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.selectedCellRow = null;
this.choiceSetSelectionListener = choiceSetSelectionListener;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentChoiceSetOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing present choice set operation");
addListeners();
start();
+ block();
}
private void start(){
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
// Check if we're using a keyboard (searchable) choice set and setup keyboard properties if we need to
if (keyboardListener != null && choiceSet.getCustomKeyboardConfiguration() != null){
keyboardProperties = choiceSet.getCustomKeyboardConfiguration();
@@ -101,6 +121,10 @@ class PresentChoiceSetOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
presentChoiceSet();
}
});
@@ -139,8 +163,10 @@ class PresentChoiceSetOperation implements Runnable {
@Override
public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
- super.onError(correlationId, resultCode, info);
}
});
if (internalInterface.get() != null){
@@ -174,6 +200,16 @@ class PresentChoiceSetOperation implements Runnable {
finishOperation();
}
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Presenting Choice set failed: " + resultCode + ", " + info);
+
+ if (choiceSetSelectionListener != null){
+ choiceSetSelectionListener.onError(resultCode + ", " + info);
+ }
+ finishOperation();
+ }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(pi);
@@ -182,8 +218,7 @@ class PresentChoiceSetOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -193,6 +228,13 @@ class PresentChoiceSetOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentChoiceSetOperation.super.finishOperation();
}
});
@@ -202,13 +244,56 @@ class PresentChoiceSetOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+ }
+
+ /*
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be dismissed using the `CancelInteraction` RPC.
+ */
+ private void cancelInteraction() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a presented choice set is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented choice set interaction.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented choice set " + resultCode + " " + info);
+ };
+ });
+
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for choice set");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a choice set that has not yet been sent to Core");
+ this.cancel();
}
}
// GETTERS
PerformInteraction getPerformInteraction() {
-
PerformInteraction pi = new PerformInteraction(choiceSet.getTitle(), presentationMode, getChoiceIds());
pi.setInitialPrompt(choiceSet.getInitialPrompt());
pi.setHelpPrompt(choiceSet.getHelpPrompt());
@@ -216,6 +301,7 @@ class PresentChoiceSetOperation implements Runnable {
pi.setVrHelp(choiceSet.getVrHelpList());
pi.setTimeout(choiceSet.getTimeout() * 1000);
pi.setInteractionLayout(getLayoutMode());
+ pi.setCancelID(cancelID);
return pi;
}
@@ -260,6 +346,10 @@ class PresentChoiceSetOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
index 06d86edd5..5089d0c92 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
@@ -40,9 +40,11 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -57,7 +59,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-class PresentKeyboardOperation implements Runnable {
+class PresentKeyboardOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private KeyboardListener keyboardListener;
@@ -65,24 +67,38 @@ class PresentKeyboardOperation implements Runnable {
private boolean updatedKeyboardProperties;
private String initialText;
private OnRPCNotificationListener keyboardRPCListener;
+ private Integer cancelID;
+ SdlMsgVersion sdlMsgVersion;
- PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener){
+ PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.customConfig = customConfig;
this.initialText = initialText;
+ this.cancelID = cancelID;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentKeyboardOperation.super.run();
+ DebugTool.logInfo("Keyboard Operation: Executing present keyboard operation");
addListeners();
start();
+ block();
}
private void start(){
DebugTool.logInfo("Choice Operation: Executing present keyboard operation");
+
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
if (keyboardListener != null){
keyboardProperties = customConfig;
updatedKeyboardProperties = true;
@@ -91,6 +107,11 @@ class PresentKeyboardOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
presentKeyboard();
}
});
@@ -99,9 +120,7 @@ class PresentKeyboardOperation implements Runnable {
// SENDING REQUESTS
private void presentKeyboard(){
-
if (internalInterface.get() != null){
-
PerformInteraction pi = getPerformInteraction();
pi.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
@@ -121,11 +140,52 @@ class PresentKeyboardOperation implements Runnable {
}else{
DebugTool.logError("Internal Interface null in present keyboard operation - choice");
}
+ }
+ /**
+ * 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.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ */
+ void dismissKeyboard() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a keyboard is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented keyboard.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented keyboard " + resultCode + " " + info);
+ }
+ });
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for keyboard.");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a keyboard that has not yet been sent to Core.");
+ this.cancel();
+ }
}
private void updateKeyboardProperties(final CompletionListener listener){
-
if (keyboardProperties == null){
if (listener != null){
listener.onComplete(false);
@@ -157,6 +217,9 @@ class PresentKeyboardOperation implements Runnable {
@Override
public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
super.onError(correlationId, resultCode, info);
}
@@ -169,8 +232,7 @@ class PresentKeyboardOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -180,6 +242,13 @@ class PresentKeyboardOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentKeyboardOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentKeyboardOperation.super.finishOperation();
}
});
@@ -189,6 +258,8 @@ class PresentKeyboardOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentKeyboardOperation.super.finishOperation();
}
}
@@ -200,9 +271,14 @@ class PresentKeyboardOperation implements Runnable {
pi.setInteractionMode(InteractionMode.MANUAL_ONLY);
pi.setInteractionChoiceSetIDList(Collections.<Integer>emptyList());
pi.setInteractionLayout(LayoutMode.KEYBOARD);
+ pi.setCancelID(cancelID);
return pi;
}
+ public Integer getCancelID() {
+ return cancelID;
+ }
+
// LISTENERS
private void addListeners(){
@@ -210,6 +286,10 @@ class PresentKeyboardOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index f9be78036..f53331157 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -55,11 +55,13 @@ import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
@@ -117,8 +119,6 @@ abstract class BaseMenuManager extends BaseSubManager {
lastMenuId = menuCellIdMin;
dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
sdlMsgVersion = internalInterface.getSdlMsgVersion();
- // default menu configuration
- menuConfiguration = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
addListeners();
}
@@ -256,54 +256,141 @@ abstract class BaseMenuManager extends BaseSubManager {
return this.dynamicMenuUpdatesMode;
}
- /**
- * This method is called via the screen manager to set the menuConfiguration.
- * This will be used when a menu item with sub-cells has a null value for menuConfiguration
- * @param menuConfiguration - The default menuConfiguration
- */
- public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
-
- if (sdlMsgVersion == null) {
- DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
- return;
- }
-
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
- return;
- }
-
- if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
- // We are in NONE or the menu is in use, bail out of here
- DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
- return;
- }
-
- // In the future, when the manager is switched to use queues, the menuConfiguration should be set when SetGlobalProperties response is received
- this.menuConfiguration = menuConfiguration;
-
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setMenuLayout(menuConfiguration.getMenuLayout());
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()){
- DebugTool.logInfo("Menu Configuration successfully set: "+ menuConfiguration.toString());
+ // OPEN MENU RPCs
+
+ /**
+ * Opens the Main Menu
+ */
+ public boolean openMenu(){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Main Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Main Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+ internalInterface.sendRPC(showAppMenu);
+ return true;
+ }
+
+ /**
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Sub menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ if (oldMenuCells == null){
+ DebugTool.logError("open sub menu called, but no Menu cells have been set");
+ return false;
+ }
+ // We must see if we have a copy of this cell, since we clone the objects
+ for (MenuCell clonedCell : oldMenuCells){
+ if (clonedCell.equals(cell) && clonedCell.getCellId() != MAX_ID){
+ // We've found the correct sub menu cell
+ sendOpenSubMenu(clonedCell.getCellId());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void sendOpenSubMenu(Integer id){
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setMenuID(id);
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Sub Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Sub Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+
+ internalInterface.sendRPC(showAppMenu);
+ }
+
+ // MENU CONFIG
+
+ /**
+ * This method is called via the screen manager to set the menuConfiguration.
+ * This will be used when a menu item with sub-cells has a null value for menuConfiguration
+ * @param menuConfiguration - The default menuConfiguration
+ */
+ public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
+
+ if (sdlMsgVersion == null) {
+ DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
+ return;
+ }
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return;
+ }
+
+ if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
+ // We are in NONE or the menu is in use, bail out of here
+ DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
+ return;
+ }
+
+ // In the future, when the manager is switched to use queues, the menuConfiguration should be set when SetGlobalProperties response is received
+ this.menuConfiguration = menuConfiguration;
+
+ if (menuConfiguration.getMenuLayout() != null) {
+
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setMenuLayout(menuConfiguration.getMenuLayout());
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ DebugTool.logInfo("Menu Configuration successfully set: " + menuConfiguration.toString());
+ }
}
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError("onError: "+ resultCode+ " | Info: "+ info );
- }
- });
- internalInterface.sendRPC(setGlobalProperties);
- }
- public MenuConfiguration getMenuConfiguration(){
- return this.menuConfiguration;
- }
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("onError: " + resultCode + " | Info: " + info);
+ }
+ });
+ internalInterface.sendRPC(setGlobalProperties);
+ } else {
+ DebugTool.logInfo("Menu Layout is null, not sending setGlobalProperties");
+ }
+ }
+ public MenuConfiguration getMenuConfiguration(){
+ return this.menuConfiguration;
+ }
// UPDATING SYSTEM
// ROOT MENU
@@ -885,7 +972,11 @@ abstract class BaseMenuManager extends BaseSubManager {
private AddSubMenu subMenuCommandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position){
AddSubMenu subMenu = new AddSubMenu(cell.getCellId(), cell.getTitle());
subMenu.setPosition(position);
- subMenu.setMenuLayout((cell.getSubMenuLayout() != null ? cell.getSubMenuLayout() : menuConfiguration.getSubMenuLayout()));
+ if (cell.getSubMenuLayout() != null ) {
+ subMenu.setMenuLayout(cell.getSubMenuLayout());
+ } else if (menuConfiguration != null && menuConfiguration.getSubMenuLayout() != null) {
+ subMenu.setMenuLayout(menuConfiguration.getSubMenuLayout());
+ }
subMenu.setMenuIcon((shouldHaveArtwork && (cell.getIcon()!= null && cell.getIcon().getImageRPC() != null)) ? cell.getIcon().getImageRPC() : null);
return subMenu;
}
@@ -937,9 +1028,12 @@ abstract class BaseMenuManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus hmiStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = hmiStatus.getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
// Auto-send an updated menu if we were in NONE and now we are not, and we need an update
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE && currentSystemContext != SystemContext.SYSCTXT_MENU){
@@ -954,7 +1048,7 @@ abstract class BaseMenuManager extends BaseSubManager {
// If we don't check for this and only update when not in the menu, there can be IN_USE errors, especially with submenus.
// We also don't want to encourage changing out the menu while the user is using it for usability reasons.
SystemContext oldContext = currentSystemContext;
- currentSystemContext = hmiStatus.getSystemContext();
+ currentSystemContext = onHMIStatus.getSystemContext();
if (oldContext == SystemContext.SYSCTXT_MENU && currentSystemContext != SystemContext.SYSCTXT_MENU && currentHMILevel != HMILevel.HMI_NONE){
if (waitingOnHMIUpdate){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
index 7ef2375ab..1000e3c1f 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
@@ -45,6 +45,7 @@ import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -295,8 +296,12 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = ((OnHMIStatus) notification).getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
// Auto-send an update if we were in NONE and now we are not
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
if (waitingOnHMIUpdate){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java
index 501c12d62..13e1f92e2 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java
@@ -41,23 +41,28 @@ import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
public class MenuConfiguration {
- private MenuLayout mainMenuLayout, defaultSubmenuLayout;
+ private MenuLayout mainMenuLayout, submenuLayout;
- public MenuConfiguration(@NonNull MenuLayout mainMenuLayout, @NonNull MenuLayout defaultSubmenuLayout){
+ /**
+ * Create a MenuConfiguration Object
+ * @param mainMenuLayout - the layout of the main menu. If `null`, it will default to whatever the head unit uses
+ * @param submenuLayout - the layout of the main menu. If `null`, it will default to whatever the head unit uses
+ */
+ public MenuConfiguration(MenuLayout mainMenuLayout, MenuLayout submenuLayout){
setMenuLayout(mainMenuLayout);
- setSubMenuLayout(defaultSubmenuLayout);
+ setSubMenuLayout(submenuLayout);
}
/**
- * Changes the default main menu layout. Defaults to `MenuLayoutList`.
+ * Changes the default main menu layout.
* @param mainMenuLayout - the layout of the main menu
*/
- private void setMenuLayout(@NonNull MenuLayout mainMenuLayout){
+ private void setMenuLayout(MenuLayout mainMenuLayout){
this.mainMenuLayout = mainMenuLayout;
}
/**
- * Changes the default main menu layout. Defaults to `MenuLayoutList`.
+ * Changes the default main menu layout.
* @return - the layout of the main menu
*/
public MenuLayout getMenuLayout() {
@@ -67,21 +72,19 @@ public class MenuConfiguration {
/**
* Changes the default submenu layout. To change this for an individual submenu, set the
* `menuLayout` property on the `MenuCell` constructor for creating a cell with sub-cells.
- * Defaults to `MenuLayoutList`.
- * @param defaultSubmenuLayout - the MenuLayout for this sub menu
+ * @param submenuLayout - the MenuLayout for this sub menu
*/
- private void setSubMenuLayout(@NonNull MenuLayout defaultSubmenuLayout){
- this.defaultSubmenuLayout = defaultSubmenuLayout;
+ private void setSubMenuLayout(MenuLayout submenuLayout){
+ this.submenuLayout = submenuLayout;
}
/**
* Changes the default submenu layout. To change this for an individual submenu, set the
* `menuLayout` property on the `MenuCell` constructor for creating a cell with sub-cells.
- * Defaults to `MenuLayoutList`.
* @return - the MenuLayout for this sub menu
*/
public MenuLayout getSubMenuLayout() {
- return defaultSubmenuLayout;
+ return submenuLayout;
}
/**
@@ -89,7 +92,7 @@ public class MenuConfiguration {
*/
@Override @NonNull
public String toString() {
- return "MenuConfiguration: MenuLayout = "+ this.mainMenuLayout + " | SubMenuLayout = "+ this.defaultSubmenuLayout;
+ return "MenuConfiguration: MenuLayout = "+ this.mainMenuLayout + " | SubMenuLayout = "+ this.submenuLayout;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
index 929e2873a..6db167567 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
@@ -529,6 +529,9 @@ public class SdlProtocolBase {
public void endSession(byte sessionID, int hashId) {
SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashId, (byte)protocolVersion.getMajor(), hashId);
handlePacketToSend(header);
+ if(transportManager != null) {
+ transportManager.close(sessionID);
+ }
} // end-method
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index a7678f29e..964000dad 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -101,8 +101,13 @@ public enum FunctionID{
GET_FILE(54, "GetFile"),
PERFORM_APP_SERVICES_INTERACTION(55, "PerformAppServiceInteraction"),
UNPUBLISH_APP_SERVICE(56, "UnpublishAppService"),
+ CANCEL_INTERACTION(57, "CancelInteraction"),
CLOSE_APPLICATION(58, "CloseApplication"),
-
+ SHOW_APP_MENU(59, "ShowAppMenu"),
+ CREATE_WINDOW(60, "CreateWindow"),
+ DELETE_WINDOW(61, "DeleteWindow"),
+ GET_INTERIOR_VEHICLE_DATA_CONSENT(62, "GetInteriorVehicleDataConsent"),
+ RELEASE_INTERIOR_VEHICLE_MODULE(63, "ReleaseInteriorVehicleDataModule"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
index 13871a9f8..eb3d00c6b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
@@ -29,8 +29,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.proxy.interfaces;
-
-public interface IProxyListenerALM extends IProxyListenerBase {
- // All methods moved into base interface
-}
+package com.smartdevicelink.proxy.interfaces;
+
+@Deprecated
+public interface IProxyListenerALM extends IProxyListenerBase {
+ // All methods moved into base interface
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index 9f34940b6..988325bd9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -38,13 +38,16 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
@@ -53,6 +56,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -85,6 +89,7 @@ import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -95,6 +100,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -111,7 +117,7 @@ import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-
+@Deprecated
public interface IProxyListenerBase {
/**
@@ -390,6 +396,10 @@ public interface IProxyListenerBase {
public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response);
+ public void onCreateWindowResponse(CreateWindowResponse response);
+
+ public void onDeleteWindowResponse(DeleteWindowResponse response);
+
public void onButtonPressResponse(ButtonPressResponse response);
public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response);
@@ -414,6 +424,10 @@ public interface IProxyListenerBase {
public void onOnAppServiceData(OnAppServiceData notification);
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response);
+
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response);
+
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification);
/**
@@ -425,10 +439,26 @@ public interface IProxyListenerBase {
public void onCloseApplicationResponse(CloseApplicationResponse response);
/**
- * UnpublishAppServiceResponse being called indicates that SDL has
- * responded to a request to close the application on the module.
+ * onCancelInteractionResponse being called indicates that SDL has
+ * responded to a request to dismiss a modal view on the module.
*
* @param response - Contains information about the response sent from SDL.
*/
- public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
-} \ No newline at end of file
+ public void onCancelInteractionResponse(CancelInteractionResponse response);
+
+ /**
+ * UnpublishAppServiceResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
+
+ /**
+ * onShowAppMenuResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onShowAppMenuResponse(ShowAppMenuResponse response);
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
index 8802e8d95..a67484131 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
@@ -39,7 +39,9 @@ import java.util.List;
/**
* Provides information to the user using either TTS, the Display or both and
- * can include a system-generated alert tone
+ * can include a system-generated alert tone.
+ *
+ * If connecting to SDL Core v.6.0+, the alert can be canceled programmatically using the `cancelID`. Canceling will not dismiss the alert's speech - only the modal view will be dismissed. On older versions of SDL Core, the alert will persist until the user has interacted with the alert or the specified timeout has elapsed.
*
* <ul>
* <li>The displayed portion of the Alert, if any, will persist until the
@@ -68,7 +70,7 @@ import java.util.List;
* <th>Name</th>
* <th>Type</th>
* <th>Description</th>
- * <th> Req.</th>
+ * <th>Req.</th>
* <th>Notes</th>
* <th>Version Available</th>
* </tr>
@@ -76,23 +78,23 @@ import java.util.List;
* <td>alertText1</td>
* <td>String</td>
* <td>Text to be displayed in the first field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
+ * <td>N</td>
+ * <td>Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText2</td>
* <td>String</td>
* <td>Text to be displayed in the second field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
+ * <td>N</td>
+ * <td>Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText3</td>
* <td>String</td>
* <td>Text to be displayed in the third field of the display during the Alert.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -100,23 +102,23 @@ import java.util.List;
* <td>ttsChunks</td>
* <td>TTSChunk[]</td>
* <td>Array of type TTSChunk which, taken together, specify what is to be spoken to the user.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>duration</td>
* <td>Integer</td>
- * <td><p>The duration of the displayed portion of the alert, in milliseconds.</p> After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
- * <td>N</td>
- * <td>Min Value: 3000 Max Value: 10000 <p>If omitted, the default is 5000 milliseconds</p></td>
+ * <td>The duration of the displayed portion of the alert, in milliseconds. After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
+ * <td>N</td>
+ * <td>Min Value: 3000 Max Value: 10000. If omitted, the default is 5000 milliseconds</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>playTone</td>
* <td>Boolean</td>
* <td>Specifies whether the alert tone should be played before the TTS (if any) is spoken.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>If omitted, default is true.</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -124,7 +126,7 @@ import java.util.List;
* <td>softButtons</td>
* <td>SoftButton[]</td>
* <td>Specifies the softbuttons, the apps wants to use in this alert.</td>
- * <td></td>
+ * <td>N</td>
* <td>If omitted on supported displays, the alert will not have any SoftButton.ArrayMin: 0; ArrayMax: 4</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -132,15 +134,23 @@ import java.util.List;
* <td>progressIndicator</td>
* <td>Boolean</td>
* <td>If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.</td>
- * <td>N</td>
+ * <td>N</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
+ * <tr>
* <td>alertIcon</td>
* <td>Image</td>
* <td>Image struct determining whether the icon is static or dynamic. If omitted on supported displays, no (or the default if applicable) icon should be displayed.</td>
- * <td>N</td>
+ * <td>N</td>
* <td></td>
* <td>SmartDeviceLink 6.0.0</td>
* </tr>
@@ -162,6 +172,7 @@ public class Alert extends RPCRequest {
public static final String KEY_PROGRESS_INDICATOR = "progressIndicator";
public static final String KEY_TTS_CHUNKS = "ttsChunks";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
public static final String KEY_ALERT_ICON = "alertIcon";
/**
@@ -373,18 +384,55 @@ public class Alert extends RPCRequest {
* </ul>
* @since SmartDeviceLink 2.0
*/
-
public void setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
}
- public Boolean getProgressIndicator() {
- return getBoolean(KEY_PROGRESS_INDICATOR);
+
+ /**
+ * Gets a Boolean value representing the progress indicator
+ *
+ * @return Boolean - If TRUE, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public Boolean getProgressIndicator() {
+ return getBoolean(KEY_PROGRESS_INDICATOR);
}
- public void setProgressIndicator(Boolean progressIndicator) {
+
+ /**
+ * Sets whether the progress indicator should be shown
+ *
+ * @param progressIndicator A Boolean value which specifies whether the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setProgressIndicator(Boolean progressIndicator) {
setParameters(KEY_PROGRESS_INDICATOR, progressIndicator);
}
/**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ };
+
+ /**
* <p>Sets the Image
* If provided, defines the image to be shown along with the alert</p>
* @param alertIcon
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
index c8e2d6d03..4210c9c2b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
@@ -44,6 +44,7 @@ public class AudioControlCapabilities extends RPCStruct {
public static final String KEY_VOLUME_AVAILABLE = "volumeAvailable";
public static final String KEY_EQUALIZER_AVAILABLE = "equalizerAvailable";
public static final String KEY_EQUALIZER_MAX_CHANNEL_ID = "equalizerMaxChannelId";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated AudioControlCapabilities object
@@ -178,4 +179,19 @@ public class AudioControlCapabilities extends RPCStruct {
return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID);
}
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
index b92d3ef16..41dcb774d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -97,6 +97,7 @@ public class ButtonCapabilities extends RPCStruct {
public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable";
public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable";
public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated ButtonCapabilities object
*/
@@ -178,4 +179,20 @@ public class ButtonCapabilities extends RPCStruct {
public void setUpDownAvailable( @NonNull Boolean upDownAvailable ) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
index 2272198be..1872138c5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
@@ -49,6 +49,7 @@ public class ButtonPress extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_BUTTON_NAME = "buttonName";
public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new ButtonPress object
@@ -136,4 +137,20 @@ public class ButtonPress extends RPCRequest {
public void setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
}
+
+ /**
+ * Sets the module id for this object
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the module id of this object
+ * @return the module id of this object
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
new file mode 100644
index 000000000..3fb02422c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/17/19 8:40 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/*
+ * Used to dismiss a modal view programmatically without needing to wait for the timeout to complete. Can be used to dismiss alerts, scrollable messages, sliders, and perform interactions (i.e. pop-up menus).
+ *
+ * @see Alert, ScrollableMessage, Slider, PerformInteraction
+ */
+public class CancelInteraction extends RPCRequest {
+ public static final String KEY_CANCEL_ID = "cancelID";
+ public static final String KEY_FUNCTION_ID = "functionID";
+
+ // Constructors
+
+ /**
+ * Constructs a new CancelInteraction object
+ */
+ public CancelInteraction() {
+ super(FunctionID.CANCEL_INTERACTION.toString());
+ }
+
+ /**
+ * Constructs a new CancelInteraction object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteraction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Convenience init for dismissing an interaction type.
+ * @param functionID - The ID of the type of interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID) {
+ this();
+ setInteractionFunctionID(functionID);
+ }
+
+ /**
+ * Convenience init for dismissing a specific interaction.
+ * @param functionID - The ID of the type of interaction to dismiss
+ * @param cancelID - The ID of the specific interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID, Integer cancelID) {
+ this();
+ setInteractionFunctionID(functionID);
+ setCancelID(cancelID);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @return - the functionID
+ */
+ public Integer getInteractionFunctionID() {
+ return getInteger(KEY_FUNCTION_ID);
+ }
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @param functionID - the functionID
+ */
+ public void setInteractionFunctionID(@NonNull Integer functionID) {
+ setParameters(KEY_FUNCTION_ID, functionID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @return - the cancelID
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @param cancelID - the cancelID
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
new file mode 100644
index 000000000..defab83c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:29 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * Response to the request to dismiss a modal view. If no applicable request can be dismissed, the `resultCode` will be `IGNORED`.
+ */
+public class CancelInteractionResponse extends RPCResponse {
+ /**
+ * Constructs a new CancelInteractionResponse object
+ */
+ public CancelInteractionResponse() { super(FunctionID.CANCEL_INTERACTION.toString()); }
+
+ /**
+ * Constructs a new CancelInteractionResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteractionResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CancelInteractionResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CancelInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
index 5a4a39c14..8d229c30a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
@@ -61,6 +61,7 @@ public class ClimateControlCapabilities extends RPCStruct{
public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable";
public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable";
public static final String KEY_HEATED_MIRRORS_AVAILABLE = "heatedMirrorsAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
public static final String KEY_CLIMATE_ENABLE_AVAILABLE = "climateEnableAvailable";
public ClimateControlCapabilities() {
@@ -406,6 +407,21 @@ public class ClimateControlCapabilities extends RPCStruct{
}
/**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
+ /**
* Sets the climateEnableAvailable portion of the ClimateControlCapabilities class
*
* @param climateEnableAvailable Availability of the control of enable/disable climate control.
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
new file mode 100644
index 000000000..c2066f1c4
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
@@ -0,0 +1,161 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import java.util.Hashtable;
+
+/**
+ * The RPC CreateWindow allows an app to create a new window on the display.
+ * The app needs to specify a window ID that is used for window manipulation e.g. with the RPC Show and the window type which can either be MAIN or WIDGET (see sub-section Window types).
+ * @since 6.0
+ */
+public class CreateWindow extends RPCRequest {
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_WINDOW_NAME = "windowName";
+ public static final String KEY_TYPE = "type";
+ public static final String KEY_ASSOCIATED_SERVICE_TYPE = "associatedServiceType";
+ public static final String KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID = "duplicateUpdatesFromWindowID";
+
+ /**
+ * Constructs a new CreateWindow object
+ */
+ public CreateWindow() {
+ super(FunctionID.CREATE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new CreateWindow object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public CreateWindow(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CreateWindow object
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ * @param windowName The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * {@code windowName.length() <= 100}
+ * @param type The type of the window to be created. Main window or widget.
+ */
+ public CreateWindow(@NonNull Integer windowID, @NonNull String windowName, @NonNull WindowType type) {
+ this();
+ setWindowID(windowID);
+ setWindowName(windowName);
+ setType(type);
+ }
+
+ /**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * The value of '0' will always be the default main window on the main display and should
+ * not be used in this context as it will already be created for the app. See PredefinedWindows enum.
+ * Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(@NonNull Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Sets a window name to be used by the HMI.
+ * The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ *
+ * @param windowName The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * {@code windowName.length() <= 100}
+ */
+ public void setWindowName(@NonNull String windowName) {
+ setParameters(KEY_WINDOW_NAME, windowName);
+ }
+
+ /**
+ * Gets a window name to be used by the HMI.
+ *
+ * @return String -a String value representing the window name.
+ */
+ public String getWindowName() {
+ return getString(KEY_WINDOW_NAME);
+ }
+
+ /**
+ * Sets the type of the window to be created. Main window or widget.
+ *
+ * @param type The type of the window to be created. Main window or widget.
+ */
+ public void setType(@NonNull WindowType type) {
+ setParameters(KEY_TYPE, type);
+ }
+
+ /**
+ * Gets a WindowType value
+ *
+ * @return WindowType -a WindowType value
+ */
+ public WindowType getType() {
+ return (WindowType) getObject(WindowType.class, KEY_TYPE);
+ }
+
+ /**
+ * Sets the associatedServiceType. It allows an app to create a widget related to a specific service type.
+ * As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ * Actions such as skip or play/pause will be directed to this active media app. In case of widgets, the system
+ * can provide a single "media" widget which will act as a placeholder for the active media app. It is only allowed
+ * to have one window per service type. This means that a media app can only have a single MEDIA widget. Still the
+ * app can create widgets omitting this parameter. Those widgets would be available as app specific widgets that are
+ * permanently included in the HMI. This parameter is related to widgets only. The default main window, which is
+ * pre-created during app registration, will be created based on the HMI types specified in the app registration request.
+ *
+ * @param associatedServiceType Allows an app to create a widget related to a specific service type.
+ * As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ */
+ public void setAssociatedServiceType(String associatedServiceType) {
+ setParameters(KEY_ASSOCIATED_SERVICE_TYPE, associatedServiceType);
+ }
+
+ /**
+ * Gets the associatedServiceType.
+ *
+ * @return String -a String value representing the associatedServiceType.
+ */
+ public String getAssociatedServiceType() {
+ return getString(KEY_ASSOCIATED_SERVICE_TYPE);
+ }
+
+ /**
+ * Sets the duplicateUpdatesFromWindowID.
+ * Its a Optional parameter. Specify whether the content sent to an existing window
+ * should be duplicated to the created window. If there isn't a window with the ID,
+ * the request will be rejected with `INVALID_DATA`.
+ *
+ * @param duplicateUpdatesFromWindowID Specify whether the content sent to an existing window should be duplicated to the created window.
+ */
+ public void setDuplicateUpdatesFromWindowID(Integer duplicateUpdatesFromWindowID) {
+ setParameters(KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, duplicateUpdatesFromWindowID);
+ }
+
+ /**
+ * Gets the duplicateUpdatesFromWindowID.
+ *
+ * @return int -an int value representing the duplicateUpdatesFromWindowID.
+ */
+ public Integer getDuplicateUpdatesFromWindowID() {
+ return getInteger(KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
new file mode 100644
index 000000000..86dac3602
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
@@ -0,0 +1,43 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import java.util.Hashtable;
+
+/**
+ * This RCP creates a window, by default the main is 0.
+ * @since 6.0
+ */
+public class CreateWindowResponse extends RPCResponse {
+
+ /**
+ * Constructs a new CreateWindowResponse object
+ */
+ public CreateWindowResponse() {
+ super(FunctionID.CREATE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new CreateWindowResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public CreateWindowResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CreateWindowResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CreateWindowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
new file mode 100644
index 000000000..52cca2a04
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
@@ -0,0 +1,63 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import java.util.Hashtable;
+
+/**
+ * This RPC deletes the window created by the CreateWindow RPC
+ * @see CreateWindow
+ * @since 6.0
+ */
+public class DeleteWindow extends RPCRequest {
+ public static final String KEY_WINDOW_ID = "windowID";
+
+ /**
+ * Constructs a new DeleteWindow object
+ */
+ public DeleteWindow() {
+ super(FunctionID.DELETE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new DeleteWindow object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public DeleteWindow(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new DeleteWindow object
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and cannot be deleted.
+ * See PredefinedWindows enum.
+ */
+ public DeleteWindow(@NonNull Integer windowID) {
+ this();
+ setWindowID(windowID);
+ }
+
+ /**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * The value of '0' will always be the default main window on the main display and cannot be deleted.
+ * See PredefinedWindows enum.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(@NonNull Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
new file mode 100644
index 000000000..d519e11d9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
@@ -0,0 +1,44 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import java.util.Hashtable;
+
+/**
+ * This RPC is the response of the DeleteWindow RPC
+ * @see DeleteWindow
+ * @since 6.0
+ */
+public class DeleteWindowResponse extends RPCResponse {
+
+ /**
+ * Constructs a new DeleteWindowResponse object
+ */
+ public DeleteWindowResponse() {
+ super(FunctionID.DELETE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new DeleteWindowResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public DeleteWindowResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new DeleteWindowResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DeleteWindowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
new file mode 100644
index 000000000..3d8862d1b
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
@@ -0,0 +1,88 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * Contain the display related information and all windows related to that display.
+ * @since 6.0
+ */
+public class DisplayCapability extends RPCStruct {
+ public static final String KEY_DISPLAY_NAME = "displayName";
+ public static final String KEY_WINDOW_TYPE_SUPPORTED = "windowTypeSupported";
+ public static final String KEY_WINDOW_CAPABILITIES = "windowCapabilities";
+
+ public DisplayCapability() {
+ }
+
+ public DisplayCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Get the name of the display
+ *
+ * @return the name of the display
+ */
+ public String getDisplayName() {
+ return getString(KEY_DISPLAY_NAME);
+ }
+
+ /**
+ * Set the name of the display
+ * {@code displayName.length() > 1}
+ *
+ * @param displayName the name of the display
+ */
+ public void setDisplayName(String displayName) {
+ setValue(KEY_DISPLAY_NAME, displayName);
+ }
+
+ /**
+ * Sets the windowTypeSupported portion of the DisplayCapability class.
+ * {@code windowTypeSupported.size()>=1}
+ *
+ * @param windowTypeSupported It informs the application how many windows the app is allowed to create per type.
+ */
+ public void setWindowTypeSupported(List<WindowTypeCapabilities> windowTypeSupported) {
+ setValue(KEY_WINDOW_TYPE_SUPPORTED, windowTypeSupported);
+ }
+
+ /**
+ * Gets the windowTypeSupported portion of the DisplayCapability class
+ *
+ * @return List<WindowTypeCapabilities>
+ * It informs the application how many windows the app is allowed to create per type.
+ */
+ @SuppressWarnings("unchecked")
+ public List<WindowTypeCapabilities> getWindowTypeSupported() {
+ return (List<WindowTypeCapabilities>) getObject(WindowTypeCapabilities.class, KEY_WINDOW_TYPE_SUPPORTED);
+ }
+
+ /**
+ * Sets the windowCapabilities portion of the DisplayCapability class.
+ *
+ * @param windowCapabilities Contains a list of capabilities of all windows related to the app.
+ * Once the app has registered the capabilities of all windows are provided.
+ * GetSystemCapability still allows requesting window capabilities of all windows.
+ * After registration, only windows with capabilities changed will be included.
+ * Following cases will cause only affected windows to be included:
+ * 1. App creates a new window. After the window is created, a system capability notification will be sent related only to the created window.
+ * 2. App sets a new template to the window. The new template changes window capabilties. The notification will reflect those changes to the single window.
+ */
+ public void setWindowCapabilities(List<WindowCapability> windowCapabilities) {
+ setValue(KEY_WINDOW_CAPABILITIES, windowCapabilities);
+ }
+
+ /**
+ * Gets the windowCapabilities portion of the DisplayCapability class
+ *
+ * @return List<WindowCapability>
+ * Contains a list of capabilities of all windows related to the app.
+ */
+ @SuppressWarnings("unchecked")
+ public List<WindowCapability> getWindowCapabilities() {
+ return (List<WindowCapability>) getObject(WindowCapability.class, KEY_WINDOW_CAPABILITIES);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
index fecf4463f..a2999ae3b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
@@ -49,6 +49,7 @@ import java.util.Hashtable;
public class GetInteriorVehicleData extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_SUBSCRIBE = "subscribe";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new GetInteriorVehicleData object
@@ -118,4 +119,20 @@ public class GetInteriorVehicleData extends RPCRequest {
public Boolean getSubscribe() {
return getBoolean(KEY_SUBSCRIBE);
}
+
+ /**
+ * Sets the Module ID for this class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of this class
+ * @return the Module ID of this class
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
new file mode 100644
index 000000000..fd53bedf2
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
@@ -0,0 +1,66 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsent extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleIds";
+
+ public GetInteriorVehicleDataConsent() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsent(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * @param moduleType Sets the Module Type for this class
+ * @param moduleIds Sets the Module Ids for this class
+ */
+ public GetInteriorVehicleDataConsent(@NonNull ModuleType moduleType, @NonNull List<String> moduleIds){
+ this();
+ setModuleType(moduleType);
+ setModuleIds(moduleIds);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(@NonNull ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param ids the ids to be set
+ */
+ public void setModuleIds(@NonNull List<String> ids) {
+ setParameters(KEY_MODULE_ID, ids);
+ }
+
+ /**
+ * Gets the Module Ids of this class
+ * @return the Module Ids
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getModuleIds() {
+ return (List<String>) getObject(String.class, KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
new file mode 100644
index 000000000..e223ba6bf
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
@@ -0,0 +1,47 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponse extends RPCResponse {
+
+ public static final String KEY_ALLOWED = "allowed";
+
+ public GetInteriorVehicleDataConsentResponse() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsentResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetInteriorVehicleDataConsentResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull List<Boolean> allowed) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setAllowances(allowed);
+ }
+
+ /**
+ * Sets the list of allowances for this class
+ * @param allowances the allowances to be set
+ */
+ public void setAllowances(@NonNull List<Boolean> allowances) {
+ setParameters(KEY_ALLOWED, allowances);
+ }
+
+ /**
+ * Gets the list of allowances of this class
+ * @return the list of allowances of this class
+ */
+ @SuppressWarnings("unchecked")
+ public List<Boolean> getAllowances() {
+ return (List<Boolean>) getObject(Boolean.class, KEY_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
index d8c9d7077..0f4e70f9b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -540,4 +540,21 @@ public class GetVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index db09d86e5..60b3b7cc4 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -372,4 +372,22 @@ public class GetVehicleDataResponse extends RPCResponse {
public String getCloudAppVehicleID(){
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleData value for the vehicle data item.
+ * @return a Object related to the vehicle data
+ */
+ public Object getOEMCustomVehicleData(String vehicleDataName){
+ return getParameters(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
new file mode 100644
index 000000000..238efada0
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
@@ -0,0 +1,133 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a location (origin coordinates and span) of a vehicle component (Module)
+ */
+
+public class Grid extends RPCStruct {
+ public static final String KEY_COLUMN = "col";
+ public static final String KEY_ROW = "row";
+ public static final String KEY_LEVEL = "level";
+ public static final String KEY_COL_SPAN = "colspan";
+ public static final String KEY_ROW_SPAN = "rowspan";
+ public static final String KEY_LEVEL_SPAN = "levelspan";
+
+ public Grid() {}
+
+ public Grid(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Struct that describes a location (origin coordinates and span) of a vehicle component (Module)
+ * @param row Sets the row's value of this Grid
+ * @param column Sets the column of this Grid
+ */
+ public Grid(@NonNull Integer row, @NonNull Integer column){
+ this();
+ setRow(row);
+ setColumn(column);
+ }
+
+ /**
+ * Sets the column of this Grid
+ * @param col the column to be set
+ */
+ public void setColumn(@NonNull Integer col) {
+ setValue(KEY_COLUMN, col);
+ }
+
+ /**
+ * Get the column value of this Grid
+ * @return the column value
+ */
+ public Integer getColumn() {
+ return getInteger(KEY_COLUMN);
+ }
+
+ /**
+ * Sets the row's value of this Grid
+ * @param row the row to be set
+ */
+ public void setRow(@NonNull Integer row) {
+ setValue(KEY_ROW, row);
+ }
+
+ /**
+ * Gets the row value of this Grid
+ * @return the row value
+ */
+ public Integer getRow() {
+ return getInteger(KEY_ROW);
+ }
+
+ /**
+ * Sets the level value of this Grid
+ * @param level the level to be set
+ */
+ public void setLevel(Integer level) {
+ setValue(KEY_LEVEL, level);
+ }
+
+ /**
+ * Gets the level value of this Grid
+ * @return the level
+ */
+ public Integer getLevel() {
+ return getInteger(KEY_LEVEL);
+ }
+
+ /**
+ * Sets the column span of this Grid
+ * @param span the span to be set
+ */
+ public void setColumnSpan(Integer span) {
+ setValue(KEY_COL_SPAN, span);
+ }
+
+ /**
+ * Gets the column span of this Grid
+ * @return the column span
+ */
+ public Integer getColumnSpan() {
+ return getInteger(KEY_COL_SPAN);
+ }
+
+ /**
+ * Sets the row span of this Grid
+ * @param span the span to be set
+ */
+ public void setRowSpan(Integer span) {
+ setValue(KEY_ROW_SPAN, span);
+ }
+
+ /**
+ * Gets the row span of this Grid
+ * @return the row span
+ */
+ public Integer getRowSpan() {
+ return getInteger(KEY_ROW_SPAN);
+ }
+
+ /**
+ * Sets the level span of this Grid
+ * @param span the span to be set
+ */
+ public void setLevelSpan(Integer span) {
+ setValue(KEY_LEVEL_SPAN, span);
+ }
+
+ /**
+ * Gets the level span of this Grid
+ * @return the level span
+ */
+ public Integer getLevelSpan() {
+ return getInteger(KEY_LEVEL_SPAN);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
index 80b030ad2..c9a7d690f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
@@ -42,6 +42,7 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public static final String KEY_DISTANCE_UNIT_AVAILABLE = "distanceUnitAvailable";
public static final String KEY_TEMPERATURE_UNIT_AVAILABLE = "temperatureUnitAvailable";
public static final String KEY_DISPLAY_MODE_UNIT_AVAILABLE = "displayModeUnitAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new HMISettingsControlCapabilities object
@@ -135,4 +136,20 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public Boolean getDisplayModeUnitAvailable() {
return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
index 1e6f25c24..32e9a46fc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
@@ -95,16 +95,32 @@ public class ImageResolution extends RPCStruct {
setResolutionWidth(resolutionWidth);
setResolutionHeight(resolutionHeight);
}
-
+
+ /**
+ * @param resolutionWidth the desired resolution width. Odds values cause problems in
+ * the Android H264 decoder, as a workaround the odd value is
+ * converted to a pair value.
+ */
public void setResolutionWidth(@NonNull Integer resolutionWidth) {
+ if(resolutionWidth != null && resolutionWidth % 2 != 0) {
+ resolutionWidth++;
+ }
setValue(KEY_RESOLUTION_WIDTH, resolutionWidth);
}
public Integer getResolutionWidth() {
return getInteger(KEY_RESOLUTION_WIDTH);
}
-
+
+ /**
+ * @param resolutionHeight the desired resolution height. Odds values cause problems in
+ * the Android H264 decoder, as a workaround the odd value is
+ * converted to a pair value.
+ */
public void setResolutionHeight(@NonNull Integer resolutionHeight) {
+ if(resolutionHeight != null && resolutionHeight % 2 != 0) {
+ resolutionHeight++;
+ }
setValue(KEY_RESOLUTION_HEIGHT, resolutionHeight);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
index 2c1e63455..a3b66467c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
@@ -41,6 +41,7 @@ import java.util.List;
public class LightControlCapabilities extends RPCStruct {
public static final String KEY_MODULE_NAME = "moduleName";
public static final String KEY_SUPPORTED_LIGHTS = "supportedLights";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new LightControlCapabilities object
@@ -106,4 +107,20 @@ public class LightControlCapabilities extends RPCStruct {
public void setSupportedLights(@NonNull List<LightCapabilities> supportedLights) {
setValue(KEY_SUPPORTED_LIGHTS, supportedLights);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
index 8f11dc556..26cf08684 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
@@ -46,6 +46,7 @@ public class ModuleData extends RPCStruct {
public static final String KEY_AUDIO_CONTROL_DATA = "audioControlData";
public static final String KEY_LIGHT_CONTROL_DATA = "lightControlData";
public static final String KEY_HMI_SETTINGS_CONTROL_DATA = "hmiSettingsControlData";
+ public static final String KEY_MODULE_ID = "moduleId";
public ModuleData() {
}
@@ -186,4 +187,20 @@ public class ModuleData extends RPCStruct {
public HMISettingsControlData getHmiSettingsControlData() {
return (HMISettingsControlData) getObject(HMISettingsControlData.class, KEY_HMI_SETTINGS_CONTROL_DATA);
}
+
+ /**
+ * Sets the Module ID of the ModuleData class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of the ModuleData class
+ * @return the Module ID
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
new file mode 100644
index 000000000..fd7be795f
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a module within different SystemCapabilities
+ */
+public class ModuleInfo extends RPCStruct {
+ public static final String KEY_MODULE_ID = "moduleId";
+ public static final String KEY_MODULE_LOCATION = "location";
+ public static final String KEY_MODULE_SERVICE_AREA = "serviceArea";
+ public static final String KEY_MULTIPLE_ACCESS_ALLOWED = "allowMultipleAccess";
+
+ public ModuleInfo(){}
+
+ public ModuleInfo(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Struct that describes a module within different SystemCapabilities
+ * @param moduleId Sets the Module ID for this Module
+ */
+ public ModuleInfo(@NonNull String moduleId){
+ this();
+ setModuleId(moduleId);
+ }
+
+ /**
+ * Sets the Module ID for this Module
+ * @param id the id to be set
+ */
+ public void setModuleId(@NonNull String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID for this module
+ * @return the Module ID as a String
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+
+ /**
+ * Sets the location of this Module
+ * @param location the location to be set
+ */
+ public void setModuleLocation(Grid location) {
+ setValue(KEY_MODULE_LOCATION, location);
+ }
+
+ /**
+ * Gets the location of this Module
+ * @return the location of this Module
+ */
+ public Grid getModuleLocation() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_LOCATION);
+ }
+
+ /**
+ * Sets the service area of this Module
+ * @param serviceArea the service area of this Module
+ */
+ public void setModuleServiceArea(Grid serviceArea) {
+ setValue(KEY_MODULE_SERVICE_AREA, serviceArea);
+ }
+
+ /**
+ * Gets the service area of this Module
+ * @return the service area of this Module
+ */
+ public Grid getModuleServiceArea() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_SERVICE_AREA);
+ }
+
+ /**
+ * Sets the multiple access allowance for this Module
+ * @param isMultipleAccess the access to be set
+ */
+ public void setMultipleAccessAllowance(Boolean isMultipleAccess) {
+ setValue(KEY_MULTIPLE_ACCESS_ALLOWED, isMultipleAccess);
+ }
+
+ /**
+ * Gets the multiple allowance access of this Module
+ * @return the multiple access allowance of this Module
+ */
+ public Boolean getMultipleAccessAllowance() {
+ return getBoolean(KEY_MULTIPLE_ACCESS_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
index e4efe5e13..f6a328dcf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -73,6 +73,8 @@ import java.util.Hashtable;
*/
public class OnDriverDistraction extends RPCNotification {
public static final String KEY_STATE = "state";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "lockScreenDismissalEnabled";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE_MSG = "lockScreenDismissalWarning";
/**
*Constructs a newly allocated OnDriverDistraction object
*/
@@ -107,5 +109,37 @@ public class OnDriverDistraction extends RPCNotification {
*/
public void setState( @NonNull DriverDistractionState state ) {
setParameters(KEY_STATE, state);
- }
+ }
+
+ /**
+ * <p>Called to set dismissible state of Lockscreen</p>
+ * @param isDismissible the Lockscreen's dismissibility
+ */
+ public void setLockscreenDismissibility(boolean isDismissible) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE, isDismissible);
+ }
+
+ /**
+ * <p>Called to get the dismissible state of Lockscreen</p>
+ * @return true if the Lockscreen is dismissible, false otherwise
+ */
+ public Boolean getLockscreenDismissibility() {
+ return (Boolean) getObject(Boolean.class, KEY_LOCKSCREEN_DISMISSIBLE);
+ }
+
+ /**
+ * Called to set a warning message for the lockscreen
+ * @param msg the message to be set
+ */
+ public void setLockscreenWarningMessage(String msg) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE_MSG, msg);
+ }
+
+ /**
+ * Called to get the lockscreen warning message
+ * @return warning message
+ */
+ public String getLockscreenWarningMessage() {
+ return (String) getObject(String.class, KEY_LOCKSCREEN_DISMISSIBLE_MSG);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
index 8f98d65a8..9970eb66a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -107,6 +107,7 @@ public class OnHMIStatus extends RPCNotification {
public static final String KEY_VIDEO_STREAMING_STATE = "videoStreamingState";
public static final String KEY_SYSTEM_CONTEXT = "systemContext";
public static final String KEY_HMI_LEVEL = "hmiLevel";
+ public static final String KEY_WINDOW_ID = "windowID";
private Boolean firstRun;
@@ -218,4 +219,22 @@ public class OnHMIStatus extends RPCNotification {
public void setFirstRun(Boolean firstRun) {
this.firstRun = firstRun;
}
+ /**
+ * <p>Set the windowID value</p>
+ * @param windowID This is the unique ID assigned to the window that this RPC is intended.
+ * If this param is not included, it will be assumed that this request is specifically for the main window on the main display.
+ * See PredefinedWindows enum.
+ * @since 6.0
+ */
+ public void setWindowID(Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+ /**
+ * <p>Get the windowID value</p>
+ * @return Integer This is the unique ID assigned to the window that this RPC is intended.
+ * @since 6.0
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
index 45dba173c..3dea74d1d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -582,4 +582,21 @@ public class OnVehicleData extends RPCNotification {
public String getCloudAppVehicleID(){
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleData value for the vehicle data item.
+ * @return a Object related to the vehicle data
+ */
+ public Object getOEMCustomVehicleData(String vehicleDataName){
+ return getParameters(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index 12be13e9f..5e253e540 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -47,7 +47,9 @@ import java.util.List;
* application may use a PerformInteraction to ask a user to say the name of a
* song to play. The user's response is only valid if it appears in the
* specified Choice Sets and is recognized by SDL
- * <p></p>
+ *
+ * If connecting to SDL Core v.6.0+, the perform interaction can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the perform interaction will persist until the user has interacted with the perform interaction or the specified timeout has elapsed.
+ *
* <p>Function Group: Base</p>
*
* <p><b>HMILevel needs to be FULL</b></p>
@@ -134,6 +136,14 @@ import java.util.List;
* <td></td>
* <td>SmartDeviceLink 3.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*
*
@@ -151,6 +161,8 @@ public class PerformInteraction extends RPCRequest {
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new PerformInteraction object
*/
@@ -168,10 +180,10 @@ public class PerformInteraction extends RPCRequest {
}
/**
* Constructs a new PerformInteraction object
- * @param initialText a String value that Displayed when the interaction begins
+ * @param initialText a String value that is displayed when the interaction begins
* @param interactionMode indicate how user selects interaction choice (VR_ONLY, MANUAL_ONLY or BOTH)
* @param interactionChoiceSetIDList a List<Integer> representing an Array of one or more Choice Set IDs. User can select any choice from any of the specified
- * Choice Sets <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
+ * Choice Sets <b>Notes: </b>Min Value: 0; Max Value: 2000000000
*/
public PerformInteraction(@NonNull String initialText, @NonNull InteractionMode interactionMode, @NonNull List<Integer> interactionChoiceSetIDList) {
this();
@@ -361,8 +373,7 @@ public class PerformInteraction extends RPCRequest {
}
/**
- * Gets a Voice recognition Help, which is a suggested VR Help Items to
- * display on-screen during Perform Interaction
+ * Gets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
*
* @return List<VrHelpItem> -a List value representing a suggested VR
* Help Items to display on-screen during Perform Interaction
@@ -374,7 +385,8 @@ public class PerformInteraction extends RPCRequest {
}
/**
- *
+ * Sets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
+ *
* @param vrHelp
* a List representing a suggested VR Help Items to display
* on-screen during Perform Interaction
@@ -387,12 +399,48 @@ public class PerformInteraction extends RPCRequest {
public void setVrHelp(List<VrHelpItem> vrHelp) {
setParameters(KEY_VR_HELP, vrHelp);
}
-
- public LayoutMode getInteractionLayout() {
+
+ /**
+ * Gets the layout mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @return LayoutMode - The interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public LayoutMode getInteractionLayout() {
return (LayoutMode) getObject(LayoutMode.class, KEY_INTERACTION_LAYOUT);
}
-
- public void setInteractionLayout( LayoutMode interactionLayout ) {
+
+ /**
+ * Sets the mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @param interactionLayout A LayoutMode representing the interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setInteractionLayout(LayoutMode interactionLayout ) {
setParameters(KEY_INTERACTION_LAYOUT, interactionLayout);
- }
+ }
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
index e729c2934..22d1d892e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
@@ -54,6 +54,7 @@ public class RadioControlCapabilities extends RPCStruct{
public static final String KEY_HD_RADIO_ENABLE_AVAILABLE = "hdRadioEnableAvailable";
public static final String KEY_SIRIUS_XM_RADIO_AVAILABLE = "siriusxmRadioAvailable";
public static final String KEY_SIS_DATA_AVAILABLE = "sisDataAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
public static final String KEY_AVAILABLE_HD_CHANNELS_AVAILABLE = "availableHdChannelsAvailable";
public RadioControlCapabilities() {
@@ -364,4 +365,20 @@ public class RadioControlCapabilities extends RPCStruct{
public Boolean getSisDataAvailable() {
return getBoolean(KEY_SIS_DATA_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
index a2e2ef646..ca37339be 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -216,6 +216,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return DisplayCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public DisplayCapabilities getDisplayCapabilities() {
return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
@@ -224,6 +225,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets Display Capabilities
* @param displayCapabilities
*/
+ @Deprecated
public void setDisplayCapabilities(DisplayCapabilities displayCapabilities) {
setParameters(KEY_DISPLAY_CAPABILITIES, displayCapabilities);
}
@@ -233,6 +235,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return buttonCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public List<ButtonCapabilities> getButtonCapabilities() {
return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
@@ -241,6 +244,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets Button Capabilities
* @param buttonCapabilities
*/
+ @Deprecated
public void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setParameters(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
}
@@ -249,6 +253,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return SoftButtonCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public List<SoftButtonCapabilities> getSoftButtonCapabilities() {
return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
@@ -257,6 +262,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets softButtonCapabilities
* @param softButtonCapabilities
*/
+ @Deprecated
public void setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
setParameters(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
}
@@ -266,6 +272,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return PresetBankCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public PresetBankCapabilities getPresetBankCapabilities() {
return (PresetBankCapabilities) getObject(PresetBankCapabilities.class, KEY_PRESET_BANK_CAPABILITIES);
@@ -274,6 +281,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets presetBankCapabilities
* @param presetBankCapabilities
*/
+ @Deprecated
public void setPresetBankCapabilities(PresetBankCapabilities presetBankCapabilities) {
setParameters(KEY_PRESET_BANK_CAPABILITIES, presetBankCapabilities);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
new file mode 100644
index 000000000..fb00c9779
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
@@ -0,0 +1,62 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModule extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleId";
+
+ public ReleaseInteriorVehicleDataModule() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModule(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * @param moduleType Sets the Module Type for this class
+ */
+ public ReleaseInteriorVehicleDataModule(@NonNull ModuleType moduleType){
+ this();
+ setModuleType(moduleType);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(@NonNull ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param id the ids to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module Id of this class
+ * @return the Module Ids
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
new file mode 100644
index 000000000..61d8df98a
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
@@ -0,0 +1,26 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponse extends RPCResponse {
+
+ public ReleaseInteriorVehicleDataModuleResponse() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
index b4e212fcc..a3bb9a567 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -42,6 +42,8 @@ import java.util.List;
/**
* Creates a full screen overlay containing a large block of formatted text that
* can be scrolled with up to 8 SoftButtons defined
+ *
+ * If connecting to SDL Core v.6.0+, the scrollable message can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the scrollable message will persist until the user has interacted with the scrollable message or the specified timeout has elapsed.
*
* <p>Function Group: ScrollableMessage</p>
*
@@ -81,6 +83,14 @@ import java.util.List;
* <td>minsize=0; maxsize=8</td>
* <td>SmartDevice Link 1.0 </td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific ScrollableMessage to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
* <p> <b>Response</b></p>
*<b>Non-default Result Codes:</b>
@@ -102,6 +112,7 @@ public class ScrollableMessage extends RPCRequest {
public static final String KEY_SCROLLABLE_MESSAGE_BODY = "scrollableMessageBody";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
/**
* Constructs a new ScrollableMessage object
@@ -197,4 +208,26 @@ public class ScrollableMessage extends RPCRequest {
public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
index 3c875d0d1..d56a321a2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
@@ -54,6 +54,7 @@ public class SeatControlCapabilities extends RPCStruct {
public static final String KEY_MASSAGE_MODE_AVAILABLE = "massageModeAvailable";
public static final String KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE = "massageCushionFirmnessAvailable";
public static final String KEY_MEMORY_AVAILABLE = "memoryAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new SeatControlCapabilities object
@@ -367,4 +368,20 @@ public class SeatControlCapabilities extends RPCStruct {
public Boolean getMemoryAvailable() {
return getBoolean(KEY_MEMORY_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
new file mode 100644
index 000000000..a4b33d1bd
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
@@ -0,0 +1,32 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class SeatLocation extends RPCStruct {
+ public static final String KEY_GRID = "grid";
+
+ public SeatLocation(){}
+
+ public SeatLocation(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets grid data for this seat location
+ * @param grid the grid to be set
+ */
+ public void setGrid(Grid grid) {
+ setValue(KEY_GRID, grid);
+ }
+
+ /**
+ * Gets the Grid of this seat location
+ * @return the grid of this seat location
+ */
+ public Grid getGrid() {
+ return (Grid) getObject(Grid.class, KEY_GRID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
new file mode 100644
index 000000000..3fc34bada
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.proxy.rpc;
+
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class SeatLocationCapability extends RPCStruct {
+ public static final String KEY_ROWS = "rows";
+ public static final String KEY_COLS = "columns";
+ public static final String KEY_LEVELS = "levels";
+ public static final String KEY_SEATS = "seats";
+
+ public SeatLocationCapability(){}
+
+ public SeatLocationCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the seat rows for this capability
+ * @param rows rows to be set
+ */
+ public void setRows(Integer rows) {
+ setValue(KEY_ROWS, rows);
+ }
+
+ /**
+ * Gets the seat rows of this capability
+ * @return the seat rows
+ */
+ public Integer getRows() {
+ return getInteger(KEY_ROWS);
+ }
+
+ /**
+ * Sets the seat columns for this capability
+ * @param cols the seat columns to be set
+ */
+ public void setCols(Integer cols) {
+ setValue(KEY_COLS, cols);
+ }
+
+ /**
+ * Gets the seat columns of this capability
+ * @return the seat columns
+ */
+ public Integer getCols() {
+ return getInteger(KEY_COLS);
+ }
+
+ /**
+ * Sets the levels for this capability
+ * @param levels the levels to be set
+ */
+ public void setLevels(Integer levels) {
+ setValue(KEY_LEVELS, levels);
+ }
+
+ /**
+ * Gets the seat levels of this capability
+ * @return the seat levels
+ */
+ public Integer getLevels() {
+ return getInteger(KEY_LEVELS);
+ }
+
+ /**
+ * Sets the seat locations for this capability
+ * @param locations the locations to be set
+ */
+ public void setSeats(List<SeatLocation> locations) {
+ setValue(KEY_SEATS, locations);
+ }
+
+ /**
+ * Gets the seat locations of this capability
+ * @return the seat locations
+ */
+ @SuppressWarnings("unchecked")
+ public List<SeatLocation> getSeatLocations() {
+ return (List<SeatLocation>) getObject(SeatLocation.class, KEY_SEATS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
index 18550c1ce..562021544 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -39,6 +39,7 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
/**
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Used to set an alternate display layout. If not sent, default screen for
* given platform will be shown
*
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
index 070879a1a..0d136daf6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -41,6 +41,7 @@ import java.util.Hashtable;
import java.util.List;
/**
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Set Display Layout Response is sent, when SetDisplayLayout has been called
*
* @since SmartDeviceLink 2.0
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
index d3cf34310..82e7738ee 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -153,6 +153,7 @@ public class SetGlobalProperties extends RPCRequest {
public static final String KEY_HELP_PROMPT = "helpPrompt";
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_USER_LOCATION = "userLocation";
public static final String KEY_MENU_LAYOUT = "menuLayout";
/**
* Constructs a new SetGlobalProperties object
@@ -312,6 +313,22 @@ public class SetGlobalProperties extends RPCRequest {
setParameters(KEY_KEYBOARD_PROPERTIES, keyboardProperties);
}
+ /**
+ * Sets the user seat location
+ * @param location the location to be set
+ */
+ public void setUserLocation(SeatLocation location) {
+ setParameters(KEY_USER_LOCATION, location);
+ }
+
+ /**
+ * Gets the user seat location
+ * @return the user seat location
+ */
+ public SeatLocation getUserLocation() {
+ return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION);
+ }
+
@SuppressWarnings("unchecked")
public KeyboardProperties getKeyboardProperties() {
return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
index 63ce0e44b..f3546dcc8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
@@ -204,6 +204,8 @@ public class Show extends RPCRequest {
public static final String KEY_SECONDARY_GRAPHIC = "secondaryGraphic";
public static final String KEY_SOFT_BUTTONS = "softButtons";
public static final String KEY_METADATA_TAGS = "metadataTags";
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_TEMPLATE_CONFIGURATION = "templateConfiguration";
public static final String KEY_TEMPLATE_TITLE = "templateTitle";
/**
@@ -589,6 +591,48 @@ public class Show extends RPCRequest {
}
/**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * If this param is not included, it will be assumed that this request is specifically for the main window on the main display.
+ * See PredefinedWindows enum.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ *
+ * @since 6.0
+ */
+ public void setWindowID(Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Gets the templateConfiguration.
+ *
+ * @return TemplateConfiguration
+ *
+ * @since 6.0
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateConfiguration getTemplateConfiguration() {
+ return (TemplateConfiguration) getObject(TemplateConfiguration.class, KEY_TEMPLATE_CONFIGURATION);
+ }
+
+ /**
+ * Sets the templateConfiguration. It's used to set an alternate template layout to a window.
+ * @param templateConfiguration
+ */
+ public void setTemplateConfiguration(TemplateConfiguration templateConfiguration) {
+ setParameters(KEY_TEMPLATE_CONFIGURATION, templateConfiguration);
+ }
+
+ /**
* Sets the title of the new template that will be displayed.
* How this will be displayed is dependent on the OEM design and implementation of the template.
* @param templateTitle the title of the new template that will be displayed
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
new file mode 100644
index 000000000..6c6c2e7c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 1:44 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class ShowAppMenu extends RPCRequest {
+
+ public static final String KEY_MENU_ID = "menuID";
+
+ /**
+ * Constructs a new ShowAppMenu object
+ */
+ public ShowAppMenu() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenu object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenu(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @param menuID - The SubMenu ID to open
+ */
+ public void setMenuID(Integer menuID){
+ setParameters(KEY_MENU_ID, menuID);
+ }
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @return - MenuID int
+ */
+ public Integer getMenuID(){
+ return getInteger(KEY_MENU_ID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
new file mode 100644
index 000000000..0efdc5229
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019 Livio, 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 Livio 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.
+ *
+ * Created by brettywhite on 7/16/19 1:52 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+import java.util.Hashtable;
+
+/**
+ * The response to ShowAppMenuResponse
+ */
+public class ShowAppMenuResponse extends RPCResponse {
+ /**
+ * Constructs a new ShowAppMenuResponse object
+ */
+ public ShowAppMenuResponse() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenuResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenuResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
index 530352c6d..466879845 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -40,8 +40,9 @@ import java.util.Hashtable;
import java.util.List;
/**
- * <p>Creates a full screen or pop-up overlay (depending on platform) with a single
- * user controlled slider.</p>
+ * Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.
+ *
+ * If connecting to SDL Core v.6.0+, the slider can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the slider will persist until the user has interacted with the slider or the specified timeout has elapsed.
*
* <p>Function Group: Base</p>
*
@@ -99,6 +100,14 @@ import java.util.List;
* <td>Minvalue=0; Maxvalue=65535; Defvalue= 10000</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*<p><b>Response </b></p>
*
@@ -124,6 +133,8 @@ public class Slider extends RPCRequest {
public static final String KEY_SLIDER_FOOTER = "sliderFooter";
public static final String KEY_POSITION = "position";
public static final String KEY_TIMEOUT = "timeout";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new Slider object
*/
@@ -263,4 +274,26 @@ public class Slider extends RPCRequest {
public Integer getTimeout() {
return getInteger(KEY_TIMEOUT);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
index af770a1c9..3ccba951e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
@@ -87,6 +87,7 @@ public class SoftButtonCapabilities extends RPCStruct {
public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable";
public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable";
public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable";
+ public static final String KEY_TEXT_SUPPORTED = "textSupported";
/**
* Constructs a newly allocated SoftButtonCapabilities object
@@ -189,4 +190,21 @@ public class SoftButtonCapabilities extends RPCStruct {
public Boolean getImageSupported() {
return getBoolean( KEY_IMAGE_SUPPORTED);
}
+
+ /**
+ * set the text support. If not included, the default value should be considered true that the button will support text.
+ * @param textSupported whether the button supports the use of text or not.
+ * @since 6.0
+ */
+ public void setTextSupported(Boolean textSupported) {
+ setValue(KEY_TEXT_SUPPORTED, textSupported);
+ }
+
+ /**
+ * get the text support.
+ * @return Boolean - the text is supported or not.
+ */
+ public Boolean getTextSupported() {
+ return getBoolean( KEY_TEXT_SUPPORTED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index ccce22d04..b2e299e24 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -864,4 +864,21 @@ public class SubscribeVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index c045961a3..a1f63aa71 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -514,4 +514,21 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getCloudAppVehicleID(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleDataResult for the vehicle data item.
+ * @return a VehicleDataResult related to the vehicle data
+ */
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
index 82cb366d7..2ea186742 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import java.util.Hashtable;
+import java.util.List;
/**
* Struct that indicates the a SystemCapabilityType and houses different structs to describe particular capabilities
@@ -46,24 +47,25 @@ public class SystemCapability extends RPCStruct {
public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
public static final String KEY_NAVIGATION_CAPABILITY = "navigationCapability";
public static final String KEY_PHONE_CAPABILITY = "phoneCapability";
- public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
+ public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability";
public static final String KEY_APP_SERVICES_CAPABILITIES = "appServicesCapabilities";
-
+ public static final String KEY_SEAT_LOCATION_CAPABILITY = "seatLocationCapability";
+ public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
public SystemCapability(){}
public SystemCapability(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Create a systemCapability object
- * @param systemCapabilityType The type
- */
- public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
- this();
- setSystemCapabilityType(systemCapabilityType);
- }
+ /**
+ * Create a systemCapability object
+ * @param systemCapabilityType The type
+ */
+ public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ this();
+ setSystemCapabilityType(systemCapabilityType);
+ }
/**
*
@@ -80,25 +82,29 @@ public class SystemCapability extends RPCStruct {
setValue(KEY_SYSTEM_CAPABILITY_TYPE, value);
}
- public RPCStruct getCapabilityForType(SystemCapabilityType type) {
- if(type == null) {
- return null;
+ public Object getCapabilityForType(SystemCapabilityType type) {
+ if(type == null) {
+ return null;
}else if (type.equals(SystemCapabilityType.NAVIGATION)) {
- return (RPCStruct) getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
- } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
- return (RPCStruct) getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
- } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)){
- return (RPCStruct) getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
+ return getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
+ return getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)){
+ return getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
- return (RPCStruct) getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
+ return getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
}else if(type.equals(SystemCapabilityType.APP_SERVICES)){
return (RPCStruct) getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
- }else{
+ }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){
+ return (RPCStruct) getObject(SeatLocationCapability.class, KEY_SEAT_LOCATION_CAPABILITY);
+ }else if(type.equals(SystemCapabilityType.DISPLAYS)){
+ return getObject(DisplayCapability.class, KEY_DISPLAY_CAPABILITIES);
+ }else{
return null;
}
}
- public void setCapabilityForType(SystemCapabilityType type, RPCStruct capability){
+ public void setCapabilityForType(SystemCapabilityType type, Object capability){
if(type == null) {
return;
}else if(type.equals(SystemCapabilityType.NAVIGATION)){
@@ -106,13 +112,18 @@ public class SystemCapability extends RPCStruct {
}else if(type.equals(SystemCapabilityType.PHONE_CALL)){
setValue(KEY_PHONE_CAPABILITY, capability);
}else if(type.equals(SystemCapabilityType.VIDEO_STREAMING)){
- setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
+ setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability);
}else if(type.equals(SystemCapabilityType.APP_SERVICES)){
setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
- }else{
+ }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){
+ setValue(KEY_SEAT_LOCATION_CAPABILITY, capability);
+ }else if(type.equals(SystemCapabilityType.DISPLAYS)) {
+ setValue(KEY_DISPLAY_CAPABILITIES, capability);
+ }else{
return;
}
}
+
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
new file mode 100644
index 000000000..ed9c4c3d3
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
@@ -0,0 +1,97 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.proxy.RPCStruct;
+import java.util.Hashtable;
+
+/**
+ * Used to set an alternate template layout to a window.
+ * @since 6.0
+ */
+public class TemplateConfiguration extends RPCStruct {
+ public static final String KEY_TEMPLATE = "template";
+ public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
+ public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
+
+ /**
+ * Constructs a new TemplateConfiguration object
+ * @param template Predefined or dynamically created window template.
+ * Currently only predefined window template layouts are defined.
+ */
+ public TemplateConfiguration(@NonNull String template) {
+ this();
+ setTemplate(template);
+ }
+
+ /**
+ * Constructs a new TemplateConfiguration object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public TemplateConfiguration(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new TemplateConfiguration object
+ */
+ public TemplateConfiguration() {
+ }
+
+ /**
+ * Gets the template.
+ *
+ * @return String -an Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ */
+ public String getTemplate() {
+ return getString(KEY_TEMPLATE);
+ }
+
+ /**
+ * Sets the template. It can be Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ *
+ * @param template Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ */
+ public void setTemplate(@NonNull String template) {
+ setValue(KEY_TEMPLATE, template);
+ }
+
+ /**
+ * Gets the dayColorScheme.
+ *
+ * @return TemplateColorScheme
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateColorScheme getDayColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the dayColorScheme.
+ *
+ * @param dayColorScheme TemplateColorScheme for the day
+ */
+ public void setDayColorScheme(TemplateColorScheme dayColorScheme) {
+ setValue(KEY_DAY_COLOR_SCHEME, dayColorScheme);
+ }
+
+ /**
+ * Gets the nightColorScheme.
+ *
+ * @return TemplateColorScheme
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateColorScheme getNightColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the nightColorScheme.
+ *
+ * @param nightColorScheme TemplateColorScheme for the night
+ */
+ public void setNightColorScheme(TemplateColorScheme nightColorScheme) {
+ setValue(KEY_NIGHT_COLOR_SCHEME, nightColorScheme);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index 134ab5976..f2bfb16dc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -850,4 +850,21 @@ public class UnsubscribeVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean( KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index 6b3fb499f..580f399eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -516,4 +516,21 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getCloudAppVehicleID(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleDataResult for the vehicle data item.
+ * @return a VehicleDataResult related to the vehicle data
+ */
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
index 09bd9bcbe..e467d0407 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -74,6 +74,7 @@ import java.util.Hashtable;
public class VehicleDataResult extends RPCStruct {
public static final String KEY_DATA_TYPE = "dataType";
public static final String KEY_RESULT_CODE = "resultCode";
+ public static final String KEY_OEM_CUSTOM_DATA_TYPE = "oemCustomDataType";
public VehicleDataResult() { }
/**
@@ -84,9 +85,9 @@ public class VehicleDataResult extends RPCStruct {
*
* @param hash the Hashtable to use
*/
- public VehicleDataResult(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public VehicleDataResult(Hashtable<String, Object> hash) {
+ super(hash);
+ }
/**
* Individual published data request result.
@@ -94,21 +95,32 @@ public class VehicleDataResult extends RPCStruct {
* @param resultCode Published data result code.
*/
public VehicleDataResult(@NonNull VehicleDataType dataType, @NonNull VehicleDataResultCode resultCode){
- this();
- setDataType(dataType);
- setResultCode(resultCode);
+ this();
+ setDataType(dataType);
+ setResultCode(resultCode);
+ }
+
+ public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
+ setValue(KEY_RESULT_CODE, resultCode);
+ }
+
+ public VehicleDataResultCode getResultCode() {
+ return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
+ }
+
+ public void setDataType(@NonNull VehicleDataType dataType) {
+ setValue(KEY_DATA_TYPE, dataType);
}
- public void setDataType(@NonNull VehicleDataType dataType) {
- setValue(KEY_DATA_TYPE, dataType);
- }
- public VehicleDataType getDataType() {
- return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
- }
- public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
- setValue(KEY_RESULT_CODE, resultCode);
- }
- public VehicleDataResultCode getResultCode() {
- return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
- }
+ public VehicleDataType getDataType() {
+ return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
+ }
+
+ public void setOEMCustomVehicleDataType(String oemCustomDataType) {
+ setValue(KEY_OEM_CUSTOM_DATA_TYPE, oemCustomDataType);
+ }
+
+ public String getOEMCustomVehicleDataType() {
+ return (String) getObject(String.class, KEY_OEM_CUSTOM_DATA_TYPE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
index e3bd9425c..ca13ba74f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -32,6 +32,7 @@
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
import java.util.List;
@@ -45,6 +46,9 @@ public class VideoStreamingCapability extends RPCStruct {
public static final String KEY_MAX_BITRATE = "maxBitrate";
public static final String KEY_SUPPORTED_FORMATS = "supportedFormats";
public static final String KEY_HAPTIC_SPATIAL_DATA_SUPPORTED = "hapticSpatialDataSupported";
+ public static final String KEY_DIAGONAL_SCREEN_SIZE = "diagonalScreenSize";
+ public static final String KEY_PIXEL_PER_INCH = "pixelPerInch";
+ public static final String KEY_SCALE = "scale";
public VideoStreamingCapability(){}
public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);}
@@ -92,4 +96,49 @@ public class VideoStreamingCapability extends RPCStruct {
public void setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
}
+
+ /**
+ * @return the diagonal screen size in inches.
+ */
+ public Double getDiagonalScreenSize() {
+ Object object = getValue(KEY_DIAGONAL_SCREEN_SIZE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param diagonalScreenSize the diagonal screen size in inches.
+ */
+ public void setDiagonalScreenSize(Double diagonalScreenSize) {
+ setValue(KEY_DIAGONAL_SCREEN_SIZE, diagonalScreenSize);
+ }
+
+ /**
+ * @return the diagonal resolution in pixels divided by the diagonal screen size in inches.
+ */
+ public Double getPixelPerInch() {
+ Object object = getValue(KEY_PIXEL_PER_INCH);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param pixelPerInch the diagonal resolution in pixels divided by the diagonal screen size in inches.
+ */
+ public void setPixelPerInch(Double pixelPerInch) {
+ setValue(KEY_PIXEL_PER_INCH, pixelPerInch);
+ }
+
+ /**
+ * @return the scaling factor the app should use to change the size of the projecting view.
+ */
+ public Double getScale() {
+ Object object = getValue(KEY_SCALE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param scale the scaling factor the app should use to change the size of the projecting view.
+ */
+ public void setScale(Double scale) {
+ setValue(KEY_SCALE, scale);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
new file mode 100644
index 000000000..dfca9956d
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
@@ -0,0 +1,186 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * @since 6.0
+ */
+public class WindowCapability extends RPCStruct {
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_TEXT_FIELDS = "textFields";
+ public static final String KEY_IMAGE_FIELDS = "imageFields";
+ public static final String KEY_IMAGE_TYPE_SUPPORTED = "imageTypeSupported";
+ public static final String KEY_TEMPLATES_AVAILABLE = "templatesAvailable";
+ public static final String KEY_NUM_CUSTOM_PRESETS_AVAILABLE = "numCustomPresetsAvailable";
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
+
+ public WindowCapability() {
+ }
+
+ public WindowCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the windowID. The specified ID of the window. Can be set to a predefined window, or omitted for the main window on the main display.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(Integer windowID) {
+ setValue(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return Integer
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Get an array of TextField structures.
+ *
+ * @return the List of textFields
+ */
+ @SuppressWarnings("unchecked")
+ public List<TextField> getTextFields() {
+ return (List<TextField>) getObject(TextField.class, KEY_TEXT_FIELDS);
+ }
+
+ /**
+ * Set an array of TextField structures. It's set of all fields that support text data.
+ * {@code 1<= textFields.size() <= 100}
+ *
+ * @param textFields the List of textFields
+ */
+ public void setTextFields(List<TextField> textFields) {
+ setValue(KEY_TEXT_FIELDS, textFields);
+ }
+
+ /**
+ * Get an array of ImageField structures.
+ *
+ * @return the List of imageFields
+ */
+ @SuppressWarnings("unchecked")
+ public List<ImageField> getImageFields() {
+ return (List<ImageField>) getObject(ImageField.class, KEY_IMAGE_FIELDS);
+ }
+
+ /**
+ * Set an array of ImageField structures. A set of all fields that support images.
+ * {@code 1<= ImageFields.size() <= 100}
+ *
+ * @param imageFields the List of imageFields
+ */
+ public void setImageFields(List<ImageField> imageFields) {
+ setValue(KEY_IMAGE_FIELDS, imageFields);
+ }
+
+ /**
+ * Get an array of ImageType elements.
+ *
+ * @return the List of imageTypeSupported
+ */
+ @SuppressWarnings("unchecked")
+ public List<ImageType> getImageTypeSupported() {
+ return (List<ImageType>) getObject(ImageType.class, KEY_IMAGE_TYPE_SUPPORTED);
+ }
+
+ /**
+ * Set an array of ImageType elements.
+ * {@code 0<= imageTypeSupported.size() <= 1000}
+ *
+ * @param imageTypeSupported the List of ImageType
+ */
+ public void setImageTypeSupported(List<ImageType> imageTypeSupported) {
+ setValue(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported);
+ }
+
+ /**
+ * Get an array of templatesAvailable.
+ *
+ * @return the List of templatesAvailable
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getTemplatesAvailable() {
+ return (List<String>) getObject(String.class, KEY_TEMPLATES_AVAILABLE);
+ }
+
+ /**
+ * Set an array of templatesAvailable.
+ * {@code 0<= templatesAvailable.size() <= 100}
+ *
+ * @param templatesAvailable the List of String
+ */
+ public void setTemplatesAvailable(List<String> templatesAvailable) {
+ setValue(KEY_TEMPLATES_AVAILABLE, templatesAvailable);
+ }
+
+ /**
+ * Gets the numCustomPresetsAvailable.
+ *
+ * @return Integer
+ */
+ public Integer getNumCustomPresetsAvailable() {
+ return getInteger(KEY_NUM_CUSTOM_PRESETS_AVAILABLE);
+ }
+
+ /**
+ * Sets the numCustomPresetsAvailable. The number of on-window custom presets available (if any); otherwise omitted.
+ * {@code 1<= numCustomPresetsAvailable.size() <= 100}
+ *
+ * @param numCustomPresetsAvailable
+ */
+ public void setNumCustomPresetsAvailable(Integer numCustomPresetsAvailable) {
+ setValue(KEY_NUM_CUSTOM_PRESETS_AVAILABLE, numCustomPresetsAvailable);
+ }
+
+ /**
+ * Sets the buttonCapabilities portion of the WindowCapability class.
+ * {@code 1<= buttonCapabilities.size() <= 100}
+ *
+ * @param buttonCapabilities It refers to number of buttons and the capabilities of each on-window button.
+ */
+ public void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
+ setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
+ }
+
+ /**
+ * Gets the buttonCapabilities portion of the WindowCapability class
+ *
+ * @return List<ButtonCapabilities>
+ * It refers to number of buttons and the capabilities of each on-window button.
+ */
+ @SuppressWarnings("unchecked")
+ public List<ButtonCapabilities> getButtonCapabilities() {
+ return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
+ }
+
+ /**
+ * Sets the softButtonCapabilities portion of the WindowCapability class.
+ * {@code 1<= softButtonCapabilities.size() <= 100}
+ *
+ * @param softButtonCapabilities It refers to number of soft buttons available on-window and the capabilities for each button.
+ */
+ public void setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
+ setValue(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
+ }
+
+ /**
+ * Gets the softButtonCapabilities portion of the WindowCapability class
+ *
+ * @return List<SoftButtonCapabilities>
+ * It refers to number of soft buttons available on-window and the capabilities for each button.
+ */
+ @SuppressWarnings("unchecked")
+ public List<SoftButtonCapabilities> getSoftButtonCapabilities() {
+ return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
new file mode 100644
index 000000000..c4071e93c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
@@ -0,0 +1,78 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import java.util.Hashtable;
+
+/**
+ * Used to inform an app how many window instances per type they can be created.
+ * @since 6.0
+ */
+public class WindowTypeCapabilities extends RPCStruct {
+ public static final String KEY_TYPE = "type";
+ public static final String KEY_MAXIMUM_NUMBER_OF_WINDOWS = "maximumNumberOfWindows";
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object
+ */
+ public WindowTypeCapabilities() {
+ }
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public WindowTypeCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object
+ *
+ * @param type Type of windows available, to create.
+ * @param maximumNumberOfWindows Number of windows available, to create.
+ */
+ public WindowTypeCapabilities(@NonNull WindowType type, @NonNull Integer maximumNumberOfWindows) {
+ this();
+ setType(type);
+ setMaximumNumberOfWindows(maximumNumberOfWindows);
+ }
+
+ /**
+ * set the type of Window
+ *
+ * @param type Type of windows available, to create.
+ */
+ public void setType(@NonNull WindowType type) {
+ setValue(KEY_TYPE, type);
+ }
+
+ /**
+ * get the type of Window
+ *
+ * @return WindowType
+ */
+ public WindowType getType() {
+ return (WindowType) getObject(WindowType.class, KEY_TYPE);
+ }
+
+ /**
+ * set the maximumNumberOfWindows
+ *
+ * @param maximumNumberOfWindows Number of windows available, to create.
+ */
+ public void setMaximumNumberOfWindows(@NonNull Integer maximumNumberOfWindows) {
+ setValue(KEY_MAXIMUM_NUMBER_OF_WINDOWS, maximumNumberOfWindows);
+ }
+
+ /**
+ * get the maximumNumberOfWindows
+ *
+ * @return Integer
+ */
+ public Integer getMaximumNumberOfWindows() {
+ return getInteger(KEY_MAXIMUM_NUMBER_OF_WINDOWS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
index d6a0a63aa..0990ef5ad 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -68,7 +68,12 @@ public enum GlobalProperty{
* The on-screen keyboard configuration of setGlobalProperties
*/
- KEYBOARDPROPERTIES;
+ KEYBOARDPROPERTIES,
+
+ /**
+ * The user seat location of setGlobalProperties
+ */
+ USERLOCATION;
/**
* Convert String to GlobalProperty
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
new file mode 100644
index 000000000..35b8833c0
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
@@ -0,0 +1,52 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+import java.util.EnumSet;
+
+/**
+ * specifies what windows and IDs are predefined and pre-created on behalf of the app.
+ *
+ * The default window is always available and represents the app window on the main display.
+ * It's an equivalent to today's app window.
+ * For backward compatibility, this will ensure the app always has at least the default window on the main display.
+ * The app can choose to use this predefined enum element to specifically address app's main window or to duplicate window content.
+ * It is not possible to duplicate another window to the default window.
+ *
+ * The primary widget is a special widget, that can be associated with a service type, which is used by the HMI whenever a single widget needs to represent the whole app.
+ * The primary widget should be named as the app and can be pre-created by the HMI
+ * @since 6.0
+ */
+public enum PredefinedWindows {
+ /**
+ * The default window is a main window pre-created on behalf of the app.
+ */
+ DEFAULT_WINDOW (0),
+ /**
+ * The primary widget of the app.
+ */
+ PRIMARY_WIDGET (1),
+
+ ;
+
+
+ final int VALUE;
+ /**
+ * Private constructor
+ */
+ PredefinedWindows (int value) {
+ this.VALUE = value;
+ }
+
+ public static PredefinedWindows valueForInt(int value) {
+
+ for (PredefinedWindows anEnum : EnumSet.allOf(PredefinedWindows.class)) {
+ if (anEnum.getValue() == value) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
+
+ public int getValue(){
+ return VALUE;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
index b0c8c9baf..cdd8b01a5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
@@ -148,6 +148,13 @@ package com.smartdevicelink.proxy.rpc.enums;
* <td align=center>N</td>
* <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
* </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</strong></td>
+ * </tr>
* </table>
*
*/
@@ -277,12 +284,35 @@ public enum SystemCapabilityType {
* <td>DisplayCapabilities</td>
* <td>Returns Display Capabilities</td>
* <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response received</td>
+ * <td> Available Synchronously <strong>after</strong> Register App Interface response received</td>
* </tr>
* </table>
*/
DISPLAY (false),
+
+ /**
+ * @since 6.0
+ * Returns: List<DisplayCapability>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>DISPLAYS</td>
+ * <td>List<DisplayCapability></td>
+ * <td>Returns a list of Display Capability</td>
+ * <td align=center>Y</td>
+ * <td> <strong>Since 6.0</strong> Contain the display related information and all windows related to that display.</td>
+ * </tr>
+ * </table>
+ */
+ DISPLAYS (true),
+
/**
* Available Synchronously after Register App Interface response <br>
* Returns: List<PrerecordedSpeech>
@@ -497,6 +527,27 @@ public enum SystemCapabilityType {
*/
APP_SERVICES (true),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ SEAT_LOCATION (true),
+
;
boolean IS_QUERYABLE;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
index 3ec32481a..f661ca7db 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, 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.
- */
+/*
+ * Copyright (c) 2017 - 2019, 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.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -161,6 +161,12 @@ public enum VehicleDataType {
* Notifies VEHICLEDATA_CLOUDAPPVEHICLEID may be subscribed
*/
VEHICLEDATA_CLOUDAPPVEHICLEID,
+ /**
+ * Notifies VEHICLEDATA_OEM_CUSTOM_DATA may be subscribed
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ VEHICLEDATA_OEM_CUSTOM_DATA,
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
new file mode 100644
index 000000000..754b0433c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
@@ -0,0 +1,30 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * The type of the window to be created. Main window or widget.
+ * @since 6.0
+ */
+public enum WindowType {
+ /**
+ * This window type describes the main window on a display.
+ */
+ MAIN,
+ /**
+ * A widget is a small window that the app can create to provide information and soft buttons for quick app control.
+ */
+ WIDGET;
+
+ /**
+ * Convert String to WindowType
+ *
+ * @param value String
+ * @return WindowType
+ */
+ public static WindowType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index 09919c598..f79596738 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -50,6 +50,7 @@ public class VideoStreamingParameters {
private final int DEFAULT_FRAMERATE = 30;
private final int DEFAULT_BITRATE = 512000;
private final int DEFAULT_INTERVAL = 5;
+ private final static double DEFAULT_SCALE = 1.0;
private int displayDensity;
@@ -132,10 +133,13 @@ public class VideoStreamingParameters {
*/
public void update(VideoStreamingCapability capability){
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
+ double scale = DEFAULT_SCALE;
+ if(capability.getScale() != null) { scale = capability.getScale(); }
ImageResolution resolution = capability.getPreferredResolution();
if(resolution!=null){
- if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight(resolution.getResolutionHeight()); }
- if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth(resolution.getResolutionWidth()); }
+
+ if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }
+ if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth((int)(resolution.getResolutionWidth() / scale)); }
}
List<VideoStreamingFormat> formats = capability.getSupportedFormats();
if(formats != null && formats.size()>0){
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
new file mode 120000
index 000000000..62dacca1e
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
@@ -0,0 +1 @@
+../../../../../../../../base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java \ No newline at end of file
diff --git a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
index 2a658181c..2bc02fa2f 100644
--- a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
+++ b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -61,6 +62,8 @@ public class SdlService {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -133,6 +136,23 @@ public class SdlService {
@Override
public void onError(SdlManager sdlManager, String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
diff --git a/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java b/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
index cc6ebf243..779c357ee 100644
--- a/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
+++ b/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -61,6 +62,8 @@ public class SdlService {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -133,6 +136,23 @@ public class SdlService {
@Override
public void onError(SdlManager sdlManager, String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
diff --git a/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java b/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
index c38fe3297..72e92c24b 100644
--- a/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
+++ b/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
@@ -32,5 +32,5 @@ package com.smartdevicelink;
// THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
public final class BuildConfig {
- public static final String VERSION_NAME = "4.9.0";
+ public static final String VERSION_NAME = "4.9.1";
} \ No newline at end of file
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
index 146382de9..11eaaa852 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -36,6 +36,7 @@ import android.support.annotation.NonNull;
import android.util.Log;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lifecycle.LifecycleManager;
import com.smartdevicelink.managers.permission.PermissionManager;
import com.smartdevicelink.managers.screen.ScreenManager;
@@ -43,20 +44,24 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.*;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
+import org.json.JSONException;
import java.util.*;
@@ -105,6 +110,8 @@ public class SdlManager extends BaseSdlManager{
Log.i(TAG,"Proxy is connected. Now initializing.");
synchronized (this){
if(!initStarted){
+ changeRegistrationRetry = 0;
+ checkLifecycleConfiguration();
initialize();
initStarted = true;
}
@@ -212,6 +219,60 @@ public class SdlManager extends BaseSdlManager{
}
@Override
+ protected void checkLifecycleConfiguration() {
+ final Language actualLanguage = lifecycleManager.getRegisterAppInterfaceResponse().getLanguage();
+
+ if (!actualLanguage.equals(hmiLanguage)) {
+
+ final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
+
+ if (lcu != null) {
+ ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
+ changeRegistration.setAppName(lcu.getAppName());
+ changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
+ changeRegistration.setTtsName(lcu.getTtsName());
+ changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
+ changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // go through and change sdlManager properties that were changed via the LCU update
+ hmiLanguage = actualLanguage;
+
+ if (lcu.getAppName() != null) {
+ appName = lcu.getAppName();
+ }
+
+ if (lcu.getShortAppName() != null) {
+ shortAppName = lcu.getShortAppName();
+ }
+
+ if (lcu.getTtsName() != null) {
+ ttsChunks = lcu.getTtsName();
+ }
+
+ if (lcu.getVoiceRecognitionCommandNames() != null) {
+ vrSynonyms = lcu.getVoiceRecognitionCommandNames();
+ }
+ }
+ try {
+ Log.v(TAG, response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ Log.e(TAG, "Change Registration onError: " + resultCode + " | Info: " + info);
+ }
+ });
+ _internalInterface.sendRPC(changeRegistration);
+ }
+ }
+ }
+
+ @Override
protected void initialize(){
// Instantiate sub managers
this.permissionManager = new PermissionManager(_internalInterface);
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index ee44f0d54..44d1e091a 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -31,6 +31,9 @@
*/
package com.smartdevicelink.managers;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+
public interface SdlManagerListener extends BaseSdlManagerListener {
/**
@@ -49,4 +52,17 @@ public interface SdlManagerListener extends BaseSdlManagerListener {
* @param e the exception
*/
void onError(SdlManager manager, String info, Exception e);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index c82d7c3c6..9e3314672 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -419,8 +419,16 @@ public class LifecycleManager extends BaseLifecycleManager {
}
break;
case ON_APP_INTERFACE_UNREGISTERED:
- Log.v(TAG, "on app interface unregistered");
- cleanProxy();
+
+ OnAppInterfaceUnregistered onAppInterfaceUnregistered = (OnAppInterfaceUnregistered) message;
+
+ if (!onAppInterfaceUnregistered.getReason().equals(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE)) {
+ Log.v(TAG, "on app interface unregistered");
+ cleanProxy();
+ }else{
+ Log.v(TAG, "re-registering for language change");
+ processLanguageChange();
+ }
break;
case UNREGISTER_APP_INTERFACE:
Log.v(TAG, "unregister app interface");
@@ -434,6 +442,19 @@ public class LifecycleManager extends BaseLifecycleManager {
};
+ private void processLanguageChange(){
+ if (session != null) {
+ if (session.getIsConnected()) {
+ session.close();
+ }
+ try {
+ session.startSession();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
/* *******************************************************************************************************
********************************** INTERNAL - RPC LISTENERS !! END !! *********************************
*********************************************************************************************************/